Email Invoice and T&Cs with Electronic Signature in D365FO

Docentric gives you the ability to generate electronically signed reports from D365FO. But what if you email your reports and use another feature provided by Docentric, sending the additional report attachments? The report document will be electronically signed, but the additional attachments won’t. What should be done to send emails with all attachments signed? In this article we will show you how to make small adjustments in the code to send emails with signed attachments.

To demonstrate how this solution works, we will describe the following:

  • Docentric report setup and customized DSP class,
  • Electronic signature setup,
  • Docentric Email print destination setup.

Docentric report setup and customized DSP class

We will use the Sales invoice report for this example. Instead of the Docentric replica DSP class for Sales invoice, we have implemented a new DSP class named DocSalesInvoiceWithSignedAdditionalAttachmentsDSP which inherits from the DocSalesInvoiceReportDSP class. We have selected that class in the Docentric report setup:

In this new class, we have overridden a method loadReportAttachments() and added the logic to electronically sign all additional email attachments:

  • We first call super() to make sure that all additional email attachments are loaded based on the Additional attachment rules setting in Docentric Email print destination.
  • The logic that follows after super() iterates through all loaded additional email attachments, applies electronic signature to the them, and at the end replaces the attachments from the pipeline with signed attachments.

Here is the code from our implementation:

Electronic signature setup

Docentric Electronic Signature setup > PDF Security for the Sales invoice report is shown in the image below:

This PDF Security setting will be applied not only to the report, but also to additional email attachments. No further setting is required for electronically signing additional e-mail attachments.

Learn how to setup Electronic Signatures within Docentric >>

Docentric Email print destination setup

The next step is to set up the Docentric Email print destination to attach the documents as additional email attachments. For this example, we will use the Terms & Conditions (T&C) document that is stored as a document management attachment on the legal entity.

Docentric Email print destination settings:

We enable the Open email before sending option to download the email message in the web browser and review it before sending it to the customer.

In the Additional attachment rules section of the Docentric Email print destination we set the rule to load the Terms and Conditions document and add it to the email as an additional attachment:

Learn more about the Report attachments >>

The result

Finally, after we have made all the necessary settings, let us print a Sales invoice report and check the email attachments. Since we have enabled the Open email before sending option, we can open the .eml file and review email attachments.

The email downloaded from the browser contains 2 attachments:

  • Sales invoice report,
  • Terms and Conditions document as an additional attachment.

When we open the Sales invoice report with a PDF viewer, we can see that the report has been successfully signed:

The electronically signed report was the expected result, but what about the additional email attachment document? Let us open it in PDF Viewer and check it:

That’s it! Our additional email attachment is successfully signed.

Simple, isn’t it?

Leave a Reply

Your email address will not be published.

*

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

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