0

I want to attach a report in e-mail. Format of report is PDF. And i use this code for save report with PDF format;

Args                args;
reportRun           reportRun;


args = new args();
args.name(reportStr("InventTransferShipReport"));
args.caller(this);
args.parm(transferId);
args.parmObject(setRecord);
args.menuItemName(menuitemOutputStr(InventTransferShipReport));

reportRun = new reportRun(args);
reportRun.init();
WinAPI::deleteFile("C:\\Temp\\Test.pdf");
reportRun.printJobSettings().setTarget(PrintMedium::File);
reportRun.printJobSettings().format(PrintFormat::PDF);
reportRun.printJobSettings().fileName("C:\\Temp\\Test.pdf");
reportRun.run();


if(WinAPI::fileExists("C:\\Temp\\Test.pdf"))
{
    info("done");
}
else
{
    info("error");
}

But when i debugging code i noticed that the process end when reportRun.run(); execute. So why? How can i fixed this issue?

Mumble
  • 141
  • 1
  • 8
  • Please double check your [report server setup](https://learn.microsoft.com/en-us/dynamicsax-2012/appuser-itpro/connect-microsoft-dynamics-ax-to-the-new-reporting-services-instance) and validate that the `InventTransferShipReport` report is properly deployed. – Sander Oct 30 '20 at 10:58
  • Are you sure this is for version R3? This code does not compile on my system. You probably want to use the report controller class instead to call the report. – FH-Inway Oct 30 '20 at 13:12
  • thanks for your answers. @Sander report is not SSRS Report unfortunately. – Mumble Oct 30 '20 at 13:54
  • thanks for your answer @FH-Inway what is your advice for R3 ? – Mumble Oct 30 '20 at 13:55
  • As I wrote, try the report controller class (see [ssrsReportStr](https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-compile-time-functions#ssrsreportstr)). – FH-Inway Oct 30 '20 at 15:19

0 Answers0