On D365F&O I have a requirement where the client wants multiple(3) reports to print automatically when the status is changed on a form. I have been able to successfully print all the reports from code individually, and the download option pops up asking if I want to open or save the reports. However when I try to run more than 1, only the last report pops up.
I have also tried using element.runAsync() with a class and moved the code to static methods and it returns the messages indicating the report printed successfully but no popup or download occurred. Once again only the last report popped up and was I able to download it.
Can anyone give me advice on how to solve this, or if there is a setting to automatically download the report and not even have the interaction.
Below is example of my code for 1 of the reports and it works fine. If I try to run this same report twice I would like to have it download the report twice
form...
//First run of report
element.runAsync(classNum(VRAutoPrint), staticMethodStr(VRAutoPrint,rep1),[VRParmTable],System.Threading.CancellationToken::None, formMethodStr(FormABC,FormCallBackTest));
//Second run of report
element.runAsync(classNum(VRAutoPrint), staticMethodStr(VRAutoPrint,rep1),[VRParmTable],System.Threading.CancellationToken::None, formMethodStr(FormABC,FormCallBackTest));
.....
//method in class ..
public static container autoRemittance(container _callerParm)
{
Args rmArgs = new Args();
SRSPrintDestinationSettings rmSettings;
VRRep1PrintController rmController = new VRRep1PrintController();
VRParmTable parmTable = conPeek(_callerParm, 1);
rmArgs.record(parmTable );
//rmArgs.caller(this);
rmController.parmArgs(rmArgs);
rmController.parmReportName(ssrsReportStr(VRReport1,Report));
//rmController.parmExecutionMode(SysOperationExecutionMode::Asynchronous);
rmController.parmShowDialog(false);
rmController.parmLoadFromSysLastValue(false);
// Change print settings as needed
rmSettings = rmController.parmReportContract().parmPrintSettings();
rmSettings.printMediumType(SRSPrintMediumType::File);
rmSettings.fileFormat(SRSReportFileFormat::PDF);
rmSettings.fileName('Report1_' + parmTable.StateId + '.pdf');
// Execute the report
rmController.startOperation();
return ['report1 printed for :' + parmTable.StatetId];;
}