Hello,
I am trying to run a AX report and save it to a local drive, then attach it and send an email to customer and finally delete the file.
I tried the below code but could not save it to local folder, instead it opens up on screen
Args args = new Args();
PrintJobSettings pjs = new PrintJobSettings();
SysReportRun reportRun;
filename mFile;
;
mFile = @"G:\Testing\test.pdf";
winapi::deleteFile(mFile);
pjs.fileName(mFile);
pjs.format(PrintFormat::PDF);
pjs.setTarget(PrintMedium::File);
pjs.preferredFileFormat(PrintFormat::PDF);
args.name(reportstr(XXXX));
args.record(gCerts);
reportRun = classFactory.reportRunClass(args);
reportRun.printJobSettings(pjs.packPrintJobSettings());
reportRun.query().interactive(false);
reportRun.report().interactive(false);
reportRun.init();
reportRun.run();