Append Terms and Conditions to printed Purchase orders or Invoices in D365FO

Often there is a need to append Terms and Conditions (T&C) to a printed purchase order or invoice in Dynamics 365 for Finance and Operations. Instead of printing them as the last pages of a generated document, you can also email T&C along the printed purchase order or invoice.

While our reporting add-on for D365FO Docentric AX covers both scenarios, in this article we will focus on printing T&C as the integral part of a resulting document. We will discuss two different approaches on the example of the Purchase order report.

Terms and Conditions as the part of a Docentric template

The first approach is that T&C becomes the part of a Docentric template for the Purchase order report by being entered as the fixed (static) text, e.g. at the end of the template. This also means that each time when you want to change something in your Terms and Conditions, you need to edit the template itself. Since end-users can also update templates themselves anytime in production, this isn’t really a drawback.

This approach works just fine if you don’t have multiple variants of T&C depending on, e.g. the related vendor or the language. In that case, you would need to show them conditionally, i.e. to employ IF tagging elements to show different parts of the template containing different variants of T&C. This might become cumbersome if you have too many different T&Cs, especially if they occupy multiple pages. If this is true, then we suggest taking the second approach.

Terms and Conditions as the part of a report data source

The second approach is to provide T&C as a part of the report data source and then use the SUBDOCUMENT tagging element in the template to show it. We plan to enable this as a feature in one of the next releases: setting up subdocuments as part of report data sources in Docentric report setup. However, right now adding of T&C as a subdocument can be done through X++ in Purchase order’s DSP class.

Bellow is a sample code on how to do it in the existing Purchase order’s DSP class (DocPurchPurchaseOrderReportDSP) that you can find in our Docentric AX SSRS Replicas model.

Note that this code will add all attachments from the current purchase order, so you need to make additional filtering in order to select only those attachments representing T&Cs (or just the single one).

 

Even better place for storing T&Cs would be a legal entity, or a vendor. The fetching logic will be the same only that docuRef should reference a different table.

When we regenerate the DDSP file using the changed DSP class for Purchase order, and load it to the Purchase order’s template, we will see that the new data record Subdocuments appeared in the data source. After we bind it to a newly inserted Subdocument tagging element, we can preview the document and see the result.

 

Note that you can also introduce a different page layout when T&C starts by inserting a section break in MS Word, so the result could look like the following:

There is more: Subdocuments as Word or HTML

Docentric supports two types of subdocuments: Word and HTML. HTML could also be a smart choice if you want to provide dynamic HTML formatted parts of generating documents, similar to built-in Form notes, only that Form notes contain plain (not-formatted) text.

In one of the next releases, we will introduce enhancements of built-in Form notes, so that you will be able to enter your T&C here and format them using the same rich text editor you already use for editing the email body when emailing reports or Email templates.

Until then, you can attach T&Cs and other documents provided as Word documents to a particular report type on the Form notes form, and append them as subdocuments in the corresponding report’s DSP class.

We are always happy to hear your feedback, ideas and scenarios! Feel free to tell us all about them here or write us to support@docentric.com.

7 thoughts on “Append Terms and Conditions to printed Purchase orders or Invoices in D365FO

  1. Hi Team,

    We have a requirement where we want to add Terms and Conditions but with our customized design.
    How can we download the Existing SSRS report design which we have already developed using Visual studio.

    Thanks
    Bablu

  2. Hi Bablu,

    I’m very sorry but this article applies only to our full product version:
    https://ax.docentric.com/free-vs-full-edition/

    which means that you cannot use this technique with SSRS report designs.
    You can still append Terms & Conditions to an outgoing email to a customer/vendor as additional attachment. At the moment you can do it in X++ like this:
    https://ax.docentric.com/d365-how-to-manuals/d365-report-print-destinations/d365-how-to-dynamically-change-print-destination-settings/#additionalEmailAttachments

    In the next version release you will able to do it directly on the Print destination settings form.

    Kind regards,
    Ana

  3. Hi Ana ,

    Thanks for your response but I think I wasn’t clear enough with my question.

    We want to append the Terms and Conditions which is more than 2 pages after the Purchase order report. But without the Header repeating in the terms and Conditions page just the terms and Conditions.
    As we can have single line PO or more than 40 line PO the header may repeat or not depending on the no of lines.
    We tried entering the terms and conditions manually as text in the Template but it prints with the header in the next page.

    I have got a evaluation license FYI from your support.
    Thanks
    bablu

  4. Hi Bablu,

    This can be very easily achieved by simply putting your SUB DOCUMENT tagging element that represents Terms & Conditions in a new document section.

    Note that MS Word allows you to have multiple document sections in a single document, with each section having its own page settings and different set of headers and footers.

    In order to fix your problem you simple need to insert a Section Break before the SUB DOCUMENT tagging element.
    You can read more about how to work with document sections here:
    https://support.office.com/en-us/article/insert-delete-or-change-a-section-break-0eeae2d6-b906-42d3-a1bd-7e77ca8ea1f3

    You will also need to un-link the new section so that it will not inherit headers and footers from the previous section.

    Please confirm if this helped.

    Best regards,
    Jure Leskovec

    1. Hi Jure ,
      Appreciate for your prompt response…

      I have added the above code for adding the subdocument and I have set the PO ddsp to my custom class CUSTPurchPurchaseOrderDSP_OverrideRRS which extends DocDataSourceProviderSrsReporting in the PO ddsp dropdown and have generated the new DDSP using print management settings. After loading the ddsp file I couldn’t see the subdocument tag in the header dataset.

      One more question .. this subdocument feature will work only for attachments attached to the particular PO ?

      thanks
      bablu

      1. Hi Bablu,

        You did everything OK but the thing is that we did this example on the existing DSP class for Purchase order (DocPurchPurchaseOrderReportDSP), which can be found in our additional model: Docentric AX SSRS Replicas.
        We actually strongly recommend to install this model no matter if you are using Free or Full Edition because it will bring you numerous benefits such as report specific placeholders and support for improved Print archive:
        https://ax.docentric.com/d365-how-to-manuals/d365-docentric-ssrs-reports/d365-ssrs-report-docentric-replicas/d365-how-to-use-docentric-replicas-with-free-edition/

        How to make it work with your custom class
        The method which was modified in the blog article is the private method which is not overridden nor called from your custom class, so it gets never executed.
        I suggest to move this code snippet in your overridden generateXmlDataSource() method, after calling the super().
        It should look like the following:

        Please let me know if this worked out for your scenario.

        And yes, this code will work only if you attach Terms and conditions on each purchase order, which is not OK.
        Probably is better to attach this document, e.g. on particular legal entity and then fetch it from there.

        Kind regards,
        Ana

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 >>