In this article we will first discuss the features of built-in report emailing, and then we will focus on how Docentric AX improves report emailing and the Email print destination. Built-in functionality: Use of E-mail parameters In SSRS framework, built-in email functionality works in the […]
Tag: AX 2012 R2 (14)
Save Report to Attachments
We can use the Docentric File print destination and the Save to attachments option to save report to Attachments of the underlying entity, which is the report execution context record, i.e. a record of the report menu item. Let's say that we want to save […]
Some print management report destinations are not valid for batch processing
Some print management report destinations are not valid for batch processing warning occurs when posting and printing sales invoices in batch. In this article we will investigate this warning but let's first examine how posting and printing an invoice in batch differs when Print Management […]
Email and print Word documents
Let's say that we want to: 1) Generate and attach a Word document from its template, 2) Send it to specific email address at the same time, and 3) Print it to a specific printer at the same time. Also, it would be great if […]
Email reports with customized body and additional attachments
Let’s say that we want to email purchase orders with customized body and two additional attachments, which are arbitrary documents stored on file system, SharePoint or database. Instead of attaching documents with static content, we can also attach related reports, for example Purchase order product […]
Email purchase order to specific vendor contacts
Let’s say that we want to email purchase order to a vendor primary contact or to all vendor contacts which have a specific contact purpose assigned. First we have to create a Contact information purpose. Navigate to Company/Organization administration/Setup/Global address book and open the Address […]
Print purchase orders in different file formats for different vendors
Let’s say that we want to print Purchase orders as PDF files, and for specific vendors we want to print Purchase orders as Word documents. We have an opportunity to specify a particular vendor or group of vendors for which we want to have purchase […]
Print Sales Invoice to printer from code
You can print an existing Sales invoice to a printer through the following code, no matter how the Print Management setup of Sales Invoice might look like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
public static void printSalesInvoiceToPrinter() { SalesInvoiceController salesInvoiceController; SalesInvoiceContract salesInvoiceContract; CustInvoiceJour custInvoiceJour; SalesInvoiceJournalPrint salesInvoiceJournalPrint; SRSPrintDestinationSettings srsPrintDestSettings; DocPrintDestSettingsPrinter printerPrintDestSettings; Args args = new Args(); select firstOnly custInvoiceJour where custInvoiceJour.SalesId != ''; args.record(custInvoiceJour); salesInvoiceController = new SalesInvoiceController(); // Set the SalesInvoice.Report as SSRS Report Design. salesInvoiceController.parmReportName( PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesOrderInvoice).getDefaultReportFormat()); // Set the report data contract with parameters. salesInvoiceContract = salesInvoiceController.parmReportContract().parmRdpContract(); salesInvoiceContract.parmRecordId(custInvoiceJour.RecId); // Create print destination settings. srsPrintDestSettings = new SRSPrintDestinationSettings(); // Set the selected print destination to Docentric Printer print destination. srsPrintDestSettings.printMediumType(SRSPrintMediumType::Printer_DC); printerPrintDestSettings = DocPrintDestSettingsPrinter::constructWithDefaultPrinter(); srsPrintDestSettings.parmPrinterPrintDestSettings_DC(printerPrintDestSettings); // Set print destination settings. salesInvoiceController.parmReportContract().parmPrintSettings(srsPrintDestSettings); // Initalize SalesInvoiceJournalPrint class instance because there is no other way // NOT to use the Print Management setup. salesInvoiceJournalPrint = SalesInvoiceJournalPrint::construct(); salesInvoiceJournalPrint.parmPrintFormletter(NoYes::Yes); salesInvoiceJournalPrint.parmUsePrintManagement(false); salesInvoiceJournalPrint.parmUseUserDefinedDestinations(true); salesInvoiceJournalPrint.parmPrinterSettingsFormLetter( salesInvoiceController.parmReportContract().parmPrintSettings().pack()); args.caller(salesInvoiceJournalPrint); args.parmEnumType(enumNum(PrintCopyOriginal)); args.parmEnum(PrintCopyOriginal::Original); salesInvoiceController.parmArgs(args); salesInvoiceController.parmShowDialog(false); salesInvoiceController.startOperation(); } |
Print Sales Invoice to PDF file from code
You can print an existing Sales invoice to a PDF file named as SalesInvoice_<InvoiceId>.pdf through the following code, regardless of how the Print Management setup of Sales Invoice might look like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
public static void printSalesInvoiceToPdfFile() { SalesInvoiceController salesInvoiceController; SalesInvoiceContract salesInvoiceContract; CustInvoiceJour custInvoiceJour; SalesInvoiceJournalPrint salesInvoiceJournalPrint; SRSPrintDestinationSettings srsPrintDestSettings; DocPrintDestSettingsFile filePrintDestSettings; Args args = new Args(); select firstOnly custInvoiceJour where custInvoiceJour.SalesId != ''; args.record(custInvoiceJour); salesInvoiceController = new SalesInvoiceController(); // Set the SalesInvoice.Report as SSRS Report Design. salesInvoiceController.parmReportName( PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesOrderInvoice).getDefaultReportFormat()); // Set the report data contract with parameters. salesInvoiceContract = salesInvoiceController.parmReportContract().parmRdpContract(); salesInvoiceContract.parmRecordId(custInvoiceJour.RecId); salesInvoiceContract.parmCountryRegionISOCode(SysCountryRegionCode::countryInfo()); // Create print destination settings. srsPrintDestSettings = new SRSPrintDestinationSettings(); // Set the selected print destination to Docentric File print destination. srsPrintDestSettings.printMediumType(SRSPrintMediumType::File_DC); filePrintDestSettings = new DocPrintDestSettingsFile(); srsPrintDestSettings.parmFilePrintDestSettings_DC(filePrintDestSettings); // Set the Docentric File print destination settings. // -- Name of the output file. filePrintDestSettings.parmOutputFilename(@'\\Shared\SalesInvoice_@FIELD_InvoiceId@.pdf'); // -- Output file format. filePrintDestSettings.parmOutputFileFormat(DocOutputFileFormat::PDF); // Set print destination settings. salesInvoiceController.parmReportContract().parmPrintSettings(srsPrintDestSettings); // Initalize SalesInvoiceJournalPrint class instance because there is no other way // NOT to use the Print Management setup. salesInvoiceJournalPrint = SalesInvoiceJournalPrint::construct(); salesInvoiceJournalPrint.parmPrintFormletter(NoYes::Yes); salesInvoiceJournalPrint.parmUsePrintManagement(false); salesInvoiceJournalPrint.parmUseUserDefinedDestinations(true); salesInvoiceJournalPrint.parmPrinterSettingsFormLetter( salesInvoiceController.parmReportContract().parmPrintSettings().pack()); args.caller(salesInvoiceJournalPrint); args.parmEnumType(enumNum(PrintCopyOriginal)); args.parmEnum(PrintCopyOriginal::Original); salesInvoiceController.parmArgs(args); salesInvoiceController.parmShowDialog(false); salesInvoiceController.startOperation(); } |
Why I see phantom records in my SSRS report
OR: How to clean up RDP tables for Print Management reports There is a couple of possible classifications of SSRS reports considering different aspects. SSRS reports can be Query or RDP (Report Data Provider) based. Query based reports gets the data through an AX query […]