Book Image

Microsoft Dynamics AX 2012 R3 Reporting Cookbook Update

Book Image

Microsoft Dynamics AX 2012 R3 Reporting Cookbook Update

Overview of this book

Table of Contents (17 chapters)
Microsoft Dynamics AX 2012 R3 Reporting Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Auto e-mail, save as file tasks in reports


There are some reports that demand no user interaction and are expected to be directly saved in a file or e-mailed. This recipe will share how the printer settings contract can be used to achieve this in a simple manner.

How to do it…

This recipe has been divided into two sections. The first section details how to save the report to a file, and the second section details how to send it through e-mail.

Saving the report to a file

  1. To save a file onto the printer, create a new static method in the controller class or in the class from where the report is invoked.

  2. In the method, place the following code to save the report:

    public static void saveReporttoFile(Args _args)
    {
    /*if the controller is not overriden for your report then use appropriate controller*/
        SrsReportRunController controller = new PktRdlCustTransListController();
        SRSPrintDestinationSettings printSettings;
            
        controller.parmReportName(ssrsReportStr(PktRdlCustTransList, CustTransList...