Hi,
I am trying to print the 'CustAccountStatementExt' Report to a pdf file through X++ code.
Here is the code I am using. I am trying to create 1 pdf file per customer at a UNC path.
PrintJobSettings patPrintJobSettings;
Args args = new Args();
CustTable CustTable;
ReportRun ReportRun;
SysReportRun sysReportRun;
;
patPrintJobSettings = new PrintJobSettings();
CustTable = CustTable::find('00001');
patPrintJobSettings.setTarget(PrintMedium::File);
patPrintJobSettings.preferredTarget(PrintMedium::File);
patPrintJobSettings.format(PrintFormat::PDF);
patPrintJobSettings.preferredFileFormat(PrintFormat::PDF);
patPrintJobSettings.fileName("\\\\VENSANDBOX\\test\\test\\test.pdf");
args.name(reportstr(CustAccountStatementExt));
args.record(CustTable);
args.object(patPrintJobSettings);
new MenuFunction(menuitemoutputstr(CustAccountStatementExt), MenuItemType::Output).run(args);
The problem I am facing with this, is that it is opening a request form, the form that opens when we run the 'CustAccountStatementExt' MenuItem. But, I dont want any user interface. I want to be able to provide the parameters for the report through x++ code through this class I am writing and get the parameters through the dialog for this class as this class extends runbase batch.
Any help is appreciated!