Improved Print Archive
Built-in Print archive
When printing reports you can choose to archive them at the same time. Such reports are saved to Organization administration > Inquiries and reports > Print archive.
Built-in Print archive is pretty limited – you can search reports only by their caption and view them as PDF. It has the following features:
- The Type field: always set to SQL Server Reporting Services report (probably the matter of legacy)
- The Description field: set to the report caption, which is the caption of the report menu item, e.g. Show invoice for the Customer Invoice report; or set to the report ID, e.g. Report.
- Couple of additional fields: Date and time of the report creation, user which created the report, number of pages is always set to 0 except when the report was printed to a printer
- The Print preview button: download and view printed reports as PDF files
Learn how to save reports in Print archive >>
Improved Print archive
From the version 3.3.0 Docentric improves built-in Print archive by adding some interesting features such as:
- Instant document preview (from v3.4.5).
- View executed reports' print destination settings, e.g. an email message sent to a customer primary contact.
- Use dynamic placeholders to control what is written into the Description field; the Type field in the grid is hidden.
- Bring relations to a source table (e.g. sales/purchase order), a journal table (e.g. invoice journal), a customer or vendor, etc.
- Search by report name, document ID (e.g. Invoice ID), source table ID (e.g. Sales/Purchase ID), Customer/Vendor account number, etc. You can also navigate to these entities by clicking the related fields in the form.
- Download zipped, merged or encrypted report files.
- Configure Document type for archiving per company, report and report execution. Learn more >>
- Search by report parameters and Print archive note, which can be configured per report execution. Learn more >>
- Open Print archive from Customer and Vendor cards. Learn more >>
- Access Print archive from common journals. Learn more >>
- Saving proforma reports in Print archive (from v3.4.8). Learn more >>
- (Coming in v3.5.0) Print archive cleanup: Configure a Print archive clean-up job for deletion of the chosen Print archive table records and optional deletion of the corresponding archived report documents from their storage location (Azure Storage or SharePoint), based on the Document Type used for archiving.
Long-term archiving
If you generate and save millions of reports, such as invoices and customer account statements, in Print archive over time, it could lead to increased database storage consumption and less efficient searches. In such cases, it’s best practice to use Document types for archiving that point to a SharePoint location.
When the Print archive table in the database grows too large, you can run a Print archive clean-up job to remove database records while keeping all archived documents accessible and searchable on SharePoint using their metadata.
Instant document preview
In 3.4.5 version we have added a document preview window to Print archive so you can now view the archived reports while browsing through Print archive without having to download them. The preview window can be toggled on or off via the Hide/Show preview button, to allow for more columns to be shown as needed.
The built-in Print preview button is now hidden, however downloading one or more archived report files is possible via the Download button added by Docentric.
View report print destination settings
Viewing of an executed report's print destination settings works out-of-the-box for any report saved to Print archive.
Download email message
If an archived report was emailed, you can also download and view the sent email message.
Download zipped, merged or encrypted files
You can download single or multiple archived reports, zipped or merged into a single PDF document. Moreover, you can download archived reports printed in file format different from PDF. You can also download reports encrypted with passwords, if they were printed with PDF security applied.
Populate Print archive with report metadata
How to fill Docentric archive contract
If you are not using DSP classes from the Docentric AX SSRS Replicas model or you just want to fill up Docentric archive contract for a report which is part of this model, the procedure is very simple.
In the overrideReportRunSettings() method of the report custom DSP class add the following X++ code if applicable:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
public DocPlaceholderManager overrideReportRunSettings(DocReportRunContext _reportRunContext, boolean _replaceStandardPlaceholders = true) { // Replace standard placeholders. DocPlaceholderManager placeholderMng = super(_reportRunContext, _replaceStandardPlaceholders); // Replace custom placeholders: // -- Placeholder @InvoiceId@ placeholderMng.replacePlaceholderInCurrentPrintDest(#InvoiceId, placeholder_invoiceId); ... // Fill the Print archive contract. _reportRunContext.archiveContract().setCustAccount(placeholder_invoiceAccount); _reportRunContext.archiveContract().setSalesId(placeholder_salesId); _reportRunContext.archiveContract().setDocument(placeholder_invoiceId, placeholder_invoiceDate); _reportRunContext.archiveContract().setJournal(this.custInvoiceJour().RecId, DocJournalType::CustInvoiceJour); return placeholderMng; } |
This is a code snippet from Customer Invoice’s DSP class that should be adjusted to cover your scenario.
Description field in Print Archive
The Description field is automatically set up to the report caption.
Report caption is by default overtaken from SSRS framework and this is most of the time a caption of the report menu item. Sometimes, this is not provided and the report ID, i.e. report technical name, i.e. report name in AOT is used instead.
You can change the report caption in the report DSP class in X++, but starting from the version 3.3.0 you can change report caption without coding, by entering the report caption in Docentric report setup. You can even use placeholders to make it dynamic. Learn more about setting up a report caption >>
File name when previewing/downloading report
From the version 3.3.0 when you preview, i.e. download a report from Print archive, the downloaded report filename will be the same as the Description field (i.e. the report caption) of the report in Print archive.
From the version 3.4.5 the built-in Print preview button is hidden - it became redundant because of the new feature Instant document preview. However, the archived report files downloaded via the Download button still use the Description field as the filename.
X++ Hooks
We created a couple of hooks, i.e. delegates which will enable you to change writing record to Print archive using Docentric archive contract and other report execution information.
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 |
[SubscribesTo(classStr(DocReportRunDelegates), delegateStr(DocReportRunDelegates, saveToPrintArchive))] public static void DocReportRunDelegates_saveToPrintArchive(DocPrintJobHeader _printJobHeader, DocReportPrintArchiveInfo _printArchiveInfo, DocEventHandlerResult _result) { DocArchiveContract ac = _printArchiveInfo.getArchiveContract(); DocPrintReportSettings reportSettings = _printArchiveInfo.parmPrintReportSettings(); // You can use customSettings (a container) from reportSettings which can // be set in the overrideReporRunSettings() method of the report DSP class. container customSettings = reportSettings.parmCustomSettings(); str reportDescription = conPeek(customSettings, 1); // Update the built-in table for Print archive. PrintJobHeader pjh; ttsbegin; select firstonly forupdate pjh where pjh.RecId == _printJobHeader.PrintJobHeaderRecId; pjh.jobDescription = reportDescription; pjh.doUpdate(); ttscommit; // Set the values of fields of Docentric's table for Print archive. // Commiting the update of this table will take place after this method completes. _printJobHeader.AccountRole = DocAccountRole::Customer; _printJobHeader.AccountNum = 'US-001'; ... } |
Saving reports to DMS
If you have a scenario where you want to skip saving printed reports to D365FO Print archive and save them to your DMS instead, or you want to additionally save them to some other location, you can do it by using the following delegates: DocReportRunDelegates.beforeSaveToPrintArchive and DocReportRunDelegates.afterSaveToPrintArchive.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[SubscribesTo(classStr(DocReportRunDelegates), delegateStr(DocReportRunDelegates, beforeSaveToPrintArchive))] public static void DocReportRunDelegates_beforeSaveToPrintArchive( container _reportContent, SRSPrintArchiveContract _archiveContract, DocReportPrintArchiveInfo _printArchiveInfo, DocEventHandlerResult _result) { str reportId = _printArchiveInfo.parmPrintReportSettings().parmReportId(); if (reportId == ssrsReportStr(CustAccountStatementExt, Report)) { str accountNum = _printArchiveInfo.getArchiveContract().parmAccountNum(); // Do something with _reportContent, a PDF file, e.g. save it to DMS. // Cancel saving to Print Archive if needed. _result.cancelExecution(true); } } |
See also
Print Archive Document Types >>
Print Archive per Customer and Vendor >>
Print Archive Saving Settings >>
Access Print Archive from Common Journals >>
Improved Print Archive Blog Article >>
Download SSRS Report Docentric Replicas >>
IN THIS ARTICLE
- Built-in Print archive
- Improved Print archive
- Long-term archiving
- Instant document preview
- View report print destination settings
- Download email message
- Download zipped, merged or encrypted files
- Populate Print archive with report metadata
- How to fill Docentric archive contract
- Description field in Print Archive
- File name when previewing/downloading report
- X++ Hooks
- Saving reports to DMS
- See also