How to display a related related value in a Process Email Template
A client contacted us about an issue they were experiencing with the Process Email Templates. They want to send email alerts when a Task is due. The problem is that the Account name is not displaying in the email.
After reviewing the problem we discovered that process email templates cannot pull a related related value from a grandparent record.
In this scenario, let’s say you want to create a Task related to an Opportunity. When the task is created an advanced workflow kicks-off and pauses until a specified date arrives. After the date, the workflow advances to a message event. In the email message, you want to notify the recipient of Task details, Opportunity details, and the details of the Account record, which is the grandparent to the Task record. Below is the advanced workflow that we created.
The relationship between the accounts, opportunities, and tasks looks something like this.
Because you can select the account name in the field selector, you might think this will work. However, when an email is generated by the template below, the account name is always blank.
It is easy to include the details of the Task and Opportunity records. However, even though the standard Account fields are available in the Process Email Template Field Selector, the data will not show in the final email.
This is a known issue with the Advanced Workflows. An enhancement request was submitted to Sugar.
Our Studio workaround for this issue is to create a calculated field on the Opportunity record. The formula for the calculated field is related($accounts,”name”). When the Opportunity record saves, the account name is saved with the Opportunity, making this value available to the Task child record.
The final Email template looks like this.
In the end, the email template successfully sends all the data the client wants. The solution for a problem like this is not always readily apparent. By all accounts, it appears that this shouldn’t be an issue.
There are two lessons to learn here. First, the obvious lesson is how to create Process Email Templates to include data from a grandparent record. The second lesson is that Process Definitions can be tricky to troubleshoot, especially emails. So, make sure you are using all your resources including the Sugar community boards, Sugar Support, and even Faye Business Systems Group.
How can we help you resolve your Advanced Workflow problems?