Hello dear community!
Having a problem using SaveAsPdf function, don't know what's missing.
So I added trigger OnAfterAction in Post Action in Sales Order.
trigger OnAfterAction()
var
PdfFilePath: Text;
PdfFileName: Text;
begin
PdfFileName := Rec."No." + '_' + Format(Rec."Posting Date") + '_' + Rec."Sell-to Customer Name";
PdfFilePath := 'C:\DL\' + PdfFileName + '.pdf';
Report.SaveAsPdf(ReportID, PdfFilePath);
end;
PdfFileName is being generated correctly, it gets the right No., Posting Date and Sell-to Customer Name from the order, but Report.SaveAsPdf function saves report from the first Sales Order in the list.