It is possible to filter the linked entities of a 1:N and a N:N relationship during the merge process based on their IDs.
This works in combination with DocumentsCorePack and AutoMerge but only with “docx”-templates.
To achieve this you have to create a new record of the “MSCRM-ADDONS.com User/Temp Settings” entity containing a filter.
Name
Use the “Name”-field to define for which user, entity type and record ID the filter should be used.
• Structure
AMPreFilter|<<ID of the user who should use the filter>>|<<the logical name of the starting entity of the template>>|<<ID of the record (of template starting entity) for which the filter should be used>>|<<logical name of the linked entity which should be filtered>>|
• Example
AMPreFilter|{DC9B80F8-C781-46D8-9FD6-A3B610836975}|account|{7b069E5412-84F6-E111-977B-00155DC8AE09}|contact|
Value
Use the “Value”-field to define the IDs of the linked records which should be shown in the template.
• Structure
<filter>
<entity><<logical name of the linked entity which should be filtered>></entity>
<values>
<value><<ID of linked record which should be shown>></value>
<value><<ID of linked record which should be shown>></value>
…….
</values>
</filter>
• Example
<filter>
<entity>contact</entity>
<values>
<value>{12E5214A-88BF-E111-A7C1-00155DC8AE09}</value>
<value>{12E5214A-88BF-E111-A7C1-00155DC8AE09}</value>
</values>
</filter>
Important: The IDs must be in upper case and must contain brackets.
During each merge process of “docx”-templates, the DocumentsCorePack Client or the AutoMerge add-on looks for a suitable filter.
If such a filter is found, only linked records with a matching ID will be shown. The filter gets delete afterwards.
Otherwise the usual merge process remains unchanged.
Example
Here you can see an account named “ptm EDV-Systeme”. It has several contacts related.
By using the following filter, only contacts which match the GUIDs in the filter will be shown in the result document. The defined user-GUID and the user running must match as well.