Note that there are some explanatory texts on larger screens.

plurals
  1. POOpen print dialog for report from code
    text
    copied!<p>I am attempting to force open the print dialog so that all the user has to do is set the email address and press ok. I've found multiple tutorials on how to print a report to file or a printer without the print dialog, but that's not what I'm looking for.</p> <p>Typically to email a report, the user displays the report, clicks the print icon in the tool bar, and then chooses email and sends it. I want to cut out the first two steps automatically.</p> <p>This is one of my many attempts at doing this so far, but to no avail.</p> <pre><code>void emailInvoice() { Args args; ReportRun rr; Report rb; PrintJobSettings pjs; CustInvoiceJour record; ; select record where record.RecId == 5637175089; args = new Args("SalesInvoice"); args.record(record); args.parmEnum(PrintCopyOriginal::OriginalPrint); // Set report run properties rr = new ReportRun(args,''); rr.suppressReportIsEmptyMessage(true); rr.query().interactive(false); // set report properties rb = rr.report(); rb.interactive(true); // set print job settings pjs = rr.printJobSettings(); pjs.fileName(strfmt("C:\\Users\\gbonzo\\Desktop\\%1.pdf", record.SalesId)); pjs.fitToPage(true); // break the report info pages using the height of the current printer's paper pjs.virtualPageHeight(-1); // force PDF printing pjs.format(PrintFormat::PDF); pjs.setTarget(PrintMedium::Mail); pjs.viewerType(ReportOutputUserType::PDF); // lock the print job settings so can't be changed // X++ code int the report may try to change the destination // to the screen for example but this does not make // sense when running a report here pjs.lockDestinationProperties(true); // Initialize the report rr.init(); rr.run(); } </code></pre> <p>Thanks in advance for your help!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload