Print Reports to Attachments in D365FO

Print Reports to Attachments in D365FO

You can print particular reports such as invoices and collection letters to Attachments of the corresponding journals only by using the e-Invoice attachment option settable on the customer card in Dynamics 365 for Finance and Operations. But what if you want to save an invoice to Attachments of the customer or sales order instead? Or if you need to reprint the invoice and replace the existing document for some reason? What if you simply want to change Document type used for e-Invoice Attachment, which always set to File?

All of this you can achieve with Docentric Free Edition, a completely free D365FO app, which you can download here.

In this article, we will explain how to print Sales invoice to Attachments of the corresponding sales order. The prerequisite is that you also have Docentric SSRS Replicas installed.

Setup for printing to Attachments

It’s very easy – just open the Print destination settings form from Print management setup for Customer invoice, and select Docentric File print destination. Then turn on the Save to Attachments option and set additional parameters Document type, target Record type and whether the attachment file content should be replaced if the attachment with the same filename already exists – see the If Attachment already exists combobox.


Record type

We selected Source table, because we want invoices to be saved to Attachments of sales orders, and in case of Sales invoice, the source table is Sales order (SalesTable). Similarly, for the Purchase order report the source table is Purchase order (PurchTable). If we selected Account table or Journal as Record type, the invoice would be saved to Attachments of the customer or the journal record respectively.

Context record refers to the record that the printing of the report is invoked from. For example, in case of Work report this is the underlaying Work record. In case of Sales invoice, Context record is always the corresponding SalesTable table.


You can also set the Restriction property of the resulting attachment to Internal/External. This affects e-Invoices because only external attachments can be embedded in e-Invoices.


The result

If we print an invoice using Docentric File print destination with the previous setup, the output document will appear in Attachments of the related sales order. Note that the output filename of the attached document is Rechnung CIV-0001.pdf, which we achieved by using label @SYS14204 (translated as Invoice in English) and placeholder @InvoiceId@.



There is more

We extended Attachments with the new fields: Category, Language, Tags, Active from and Active to. These settings are useful when emailing reports with additional email attachments. Learn more >>


If you print a report to Attachments using Docentric File print destination with a particular Category or Language, you will be able to use these values to select the printed report as the additional email attachment of another or even the same report (e.g. by using Print management).

Moreover, in one of the next product releases, you will be able not only to select additional email attachments but also to set up which attachments you want to embed or merge to the output documents. How awesome is that!

Leave a Reply

Your email address will not be published. Required fields are marked *


Docentric respects your privacy. Learn how your comment data is processed >>

Docentric respects your privacy. Learn how your comment data is processed >>