How can I resolve related record merge fields in Email Templates in e2a?
Introduction
From e2a v3.4949 onwards, a new feature of resolving related record merge fields have introduced. Traditional resolution of merge fields, which is offered by Salesforce, does not allow you to refer to fields of a related record.
For example, if you are creating a template with 'Contact' as Related Entity Type and if you want to include 'Account Name' of the related account then it is not possible with current available functionality. But, with this enhancement in e2a now you can refer to merge fields in email templates such as Contact.Account.AccountName.
This feature can be utilized using Ortoo Email Template Assistant streamlines the creation of relationships between different templates, ensuring seamless resolution of merge fields from related or child objects. It also simplifies handling CC/BCC merge fields on the target object.
But, first we need to enable related record merge fields resolution custom setting.
How to enable Related Record Merge Fields resolution in e2a?
We need to create a Custom Metadata Type and add a setting record:
- Press on 'New'.
- Enter the Name as: Allow_Relationship_Merge_in_Template.
- Enter the Label as: Allow_Relationship_Merge_in_Template.
- Enter the Value as: true
- Press 'Save'.
To add the assistant in any of the desired App:
- Go to "Setup" in quick find search for "App Manager" select the desired app and edit it
- In the App setting, go to "Utility Items" select add Utility item.
- Search for Ortoo Email Template Assistant.
- Label it "Ortoo Email Template Assistant"
- Press Save.
Now you can easily access the Ortoo Email Template Assistant over the desired app.
How to add relationship between templates to resolve related record merge fields?
- Make sure you have already created an email template (can be referred to as 'child template') which contains local/normal merge fields in it. Let's say you create a template with 'Related Entity Type' of Account and use the merge field {{{Account.AccountName}}} in email body.
- Now create a main/parent template which you will be loading on the e2a email client. Let's say you create a template with 'Related Entity Type' of 'Contact'.
- Open the Ortoo Email Template Assistant from the template detail page of above created template.
- Select action 'Add a Relationship to a parent or child record(s)'.
- Select the appropriate Context Object.
- Select the desired field to resolve.
- Press Confirm Selection.
- Now Select the Email Template you want to create a relationship with. This will a normal email template with usual merge fields.
- Press Update HTML Content
- Press Copy to Clipboard or select the text using Ctrl/Command+C.
- Copy it to the Parent/Desired Template to utilize it.
- Now, loading of this main/template on e2a email client should result in the resolution of the relation shown in above step in such a way that it shows the account name of the respecive account of the contact selected in 'To' field.
Where can I manage this setting after it is created?
Once the setting is configured, you can manage it by navigating to Setup > Custom Metadata Types > e2a_Customer_Settings__mdt > Manage. Here, you can create, update, or delete records as needed.
Why use Custom Metadata Types for this setting?
Using Custom Metadata Types allows you to store and manage configuration settings at the application level. This approach provides flexibility and central control without requiring custom code, making it easier to maintain and update your settings across your Salesforce organization.
Is this approach recommended by Salesforce?
Yes, Salesforce recommends using Custom Metadata Types for settings like this. It provides a scalable and maintainable way to manage configurations within your Salesforce environment without modifying the underlying code.
Please contact us at support@ortooapps.com for any questions.
★★★★★ - EXCELLENT
★★★★☆ - GOOD
★★★☆☆ - OK
★★☆☆☆ - POOR
★☆☆☆☆ - RUBBISH