We are trying to setup Email Functionality Send Purchase order confirmed order in AX 2012 R2 .
We have Completed and send test email to ensure SMTP Setup working fine .
when its come to AX Po Email , we have Tried below code and it's through error , Enter Line Number .
Kindly help on this
SrsReportRunController ssrsController = new SrsReportRunController(); PurchPurchaseOrderContract Contract = new PurchPurchaseOrderContract(); SRSPrintDestinationSettings printerSettings; VendPurchOrderJour VendPurchOrderJour; str ReportPath;
select firstOnly VendPurchOrderJour order by VendPurchOrderJour.createdDateTime DESC where VendPurchOrderJour.PurchId == _PurchTable.PurchId;
ReportPath = "C:\\" + _PurchTable.PurchId +".pdf"; ssrsController.parmReportName(ssrsReportStr(PurchPurchaseOrder, Report)); ssrsController.parmExecutionMode(SysOperationExecutionMode::Synchronous); ssrsController.parmShowDialog(false); Contract.parmRecordId(VendPurchOrderJour.RecId); ssrsController.parmReportContract().parmRdpContract(Contract);
//link the printer settings to the controller printerSettings = ssrsController.parmReportContract().parmPrintSettings(); //print to pdf and always overwrite if the file exists printerSettings.printMediumType(SRSPrintMediumType::File); printerSettings.fileFormat(SRSReportFileFormat::PDF); printerSettings.overwriteFile(true); printerSettings.fileName(@ReportPath);
//run & save the report ssrsController.runReport(); return ReportPath;// return the file location where pdf saved. we use this path to email and delete after email.--
If you get an error, it would be wise to share with us what exactly the error say and where it's thrown from.
An obvious problem with your code is that you want an email but you set medium type to SRSPrintMediumType::File instead of SRSPrintMediumType::Email.
By the way, I moved your question to the Developer forum and attached the missing version tag (AX 2012). Please pay more attention to it next time.
Thank you martin , manage to sort out this issue , it was due to GST Calculation issue , moved the code right and it's working fine .