Hello all,
I have an issue which I was trying to solve on saveral ways but unfortunetly nothing works.
Objective here is to export pro forma invoice to pdf file from code (not to use a standard printing process). Let's say that I want to create a button to make such export.
I tried to use is code which seems to work but nothing happen:
SalesTable salesTable;
PrintJobSettings printJobSettings;
SalesFormLetter formLetter;
select firstOnly salesTable
where salesTable.SalesId == 'YOUR_SALES_ID';
formLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
printJobSettings = new PrintJobSettings(formLetter.printerSettingsFormletter());
printJobSettings.setTarget(PrintMedium::File);
printJobSettings.format(PrintFormat::PDF);
printJobSettings.fileName(@'C:\Temp\proforma_invoice.pdf');
formLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
formLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings());
formLetter.update(salesTable,
systemDateGet(),
SalesUpdate::All,
AccountOrder::None,
NoYes::Yes,
NoYes::Yes);
Version: AX 2012 R3
Please help!