Sage CRM 2020 R1: Support for Nested Mail Merge extended. (Part 1 of 3)

This is the first of three articles that explains the new extended support for Nested Mail Merge templates in Sage CRM 2020 R1. 

The articles will
Out of the box Sage CRM offers the capability to create mail merge documents that use the concept of a nested mail merge.  This merge takes place on the server and can either generate a PDF or Word Document.
A Nested Merge is where a merge takes place with a single outer 'header' record that has embedded within it the details of one or more child records.​
The entities that are enabled by default for nested mail merge are
  • Quotes/Quote Items
  • Orders/Order Items
  • Opportunities/Opportunity Items
Note: The Opportunity/Opportunity Items are only applicable in systems using certain types of integration.

The Nested Merge feature makes it possible to create mail merge templates that will allow a quotation or an order document to be generated that contains data from the quoteitems and orderitems tables respectively.​

To use the example of a new Quote template:  A Quotation template will draw its data from two separate views.  These are vMailMergeQuotes and vMailMergeChildrenQuotes.​

The merge process for the Quote (and Order) allows for a header and with details using information from the two separate views.​

The process of creating a Nest Merge template for the Quote or Order tables requires a user to insert special nested regions into the HTML of the template.​

A user needs to create the nested section of the template using "Insert Nested Region". It is strongly recommended that you include the child information, e.g. from the Quote Items, within the structure of a table.​

This ability to use nested mail merge with the Quotes and Orders entities is because of definitions placed in the metadata.  The merge relationship is defined in the MailMergeRelatedInfo table. The rows in the link the parental entity with the child and defines which view the child record should use and the foreign key that links the child to the parent.​
From Sage CRM 2020 R1 Sage has included the Nested Mail Merge ability for other entities with its test plan.  That means that Nested Mail Merge templates can now be added for other entities.  For example Companies and Cases.

To enable this is Sage CRM 2020 R1 new rows have to be added to the MailMergeRelatedInfo table.  These will allow custom nested mail merge templates to be created.  For example, you could create a definition to nest a list of all contacts within a company or to list the cases under a company.  You can even use custom entities within the template as the nested record, for example listing out projects associated with a company.​
There are some important limitations.
  • You are limited to one Child set of data per entity.  If you have linked Company with Cases, you should not then link Company with Opportunities.​
  • You must not delete or change the existing default definitions.
The next article will explain how to add the necessary metadata into the MailMergeRelatedInfo table