Support for Nested Mail Merge extended. (Part 2 of 3)

2 minute read time.
This is the second of three articles that explains the support for Nested Mail Merge templates in Sage CRM.

To enable nested mail merge in Sage CRM new rows have to be added to the MailMergeRelatedInfo table.  These will allow custom nested mail merge templates to be created.

The example I will use is for Companies and Cases.

The rows in the MailMergeRelatedInfo table link the parental entity(Company) with the child entity (Cases) and define which view the child record should use and the foreign key that links the child to the parent.

The fields that need to be populated in the MailMergeRelatedInfo table are shown below.
  • mmri_EntityName: Company
  • mmri_ChildEntity:? Cases
  • mmri_ChildView:? vListCases
  • mmri_LinkColumn: Case_PrimaryCompanyId
The EntityName is the parent entity.  This is the outer table to be used in the merge.  In my example, this is 'Company'.

The ChildEnity is the child entity.  This is the inner table to be used in the merge.  In other words, this is the 'nested' table which in the example I am using is 'Cases'.

ChildView is the view to be used that joins the parent entity.  I have used here an existing view 'vListCases'.

LinkColumn is the foreign key on the child that defines the relationship to the parent.  Case_PrimaryCompanyId joins a child case to its parent company.

There is no obvious way of entering the data into the MailMergeRelatedInfo table.  There is no user interface provided so this information would need to be added using the Component Manager.  The Component Manager ES script files can use and API that can insert and update metadata table values.

To make it easier to control the settings within the MailMergeRelatedInfo table I have created a component that will add the administration screens to help with managing the metadata.

You can find the component here: Update MailMergeRelatedInfo for Nested Mail Merge 
Add a definition into the table "MailMergeRelatedInfo".
Go to
Administration -> E-mail and Documents -> Nested Merge Configuration
The screen will display a grid of 4 columns listing out the existing merge definitions.  (3 in a default system) There will be a new button on the right of the screen "New Nest".
Note:  The columns are missing translations.  This is known.  This table is not normally exposed in the interface so there are no caption definitions for its columns.
Once the new record has been saved the page will display the NestMailMergeList.asp.
The next article will explain how you can now create a new Mail Marge template for the parent entity e.g. 'Company'.