I am trying to print report through code in Microsoft Dynamics AX. The code is running successfully but instead of sending the report to default printer the default print preview is showing. The code is as under:
void clicked()
{
Args args;
ReportRun reportRun;
CustConfirmJour custConfirmJour;
RecordSortedList list = new RecordSortedList(55);
SELECT firstonly custConfirmJour order by ConfirmID desc where custConfirmJour.SalesId == salesTable.SalesId ;
list.ins(custConfirmJour);
args = new Args(ReportStr(SalesConfirm));
args.designName("Standard");
reportRun = new ReportRun(args);
reportRun.args().caller(null);
reportRun.args().parmEnum(1);
reportRun.args().parmEnumType(920);
reportRun.args().object(List);
reportRun.args().name("KeepSettings");
reportRun.printJobSettings().setTarget(PrintMedium::Printer);
reportRun.run();
}
Any help will be highly appreciated.
*This post is locked for comments