In NAV 2017 Emailing the PDF by running the report using Report.SAVEASPDF is now not allowed in NAV 2018. The reason is that temporary server file as not allowed to be saved for some security reasons. Thus this blog demonstrates the workaround solution for this issue.
Step1: Generate the XMLParameters(Text) using the RUNREQUESTPAGE method and copy the results.
REQUESTPAGE is used to set the filters prior to running the report. The filters selected are passed to the report in XML format.
Value in XMLParameter: Here, Rec.Contract No. is the primary filter to be passed to the report.
Step2: Create the Instream and Outstream variables and a temporary table having BLOB field.
Create the OutStream variable for the BLOB field of the Temporary Table.
Save the data of OutStream variable using Report.SaveAs method.
Copy the data of the BLOB field to Instream
Step 3: Pass the attachment as a Stream using Instream
Note: Perform the Step 1 only if there is any filter to be applied to the report.
This workaround is to be used where the Report.SAVEASPDF cannot be used because this method is not allowed in AL.
The post Workaround to Report.SAVEASPDF in NAV 2018 appeared first on CloudFronts - Microsoft Dynamics 365 | Power BI | Azure.