This post is part of my “IdeaExchange Alternate Routes” series. Click here for more info.
The Idea
The “Cross Object Merge Fields in Email Template” idea was posted in 2009. At the time of writing this, it has garnered 73,130 points with 7,329 votes. Using the filters described here, it is the most voted on idea on the IdeaExchange today.
Here’s the full text of the idea:
While it seems that you can use cross object merge fields in an email template, because they are exposed as merge field values, it does not work. Please allow the ability to use cross objects merge fields in email templates. Right now the only workaround is to use hidden formula fields on the parent object to copy the child object fields there and then build the template using those hidden formula fields. The disadvantage to this is that you are using up your custom field quota just to create an email template.
The Problem
When creating email templates, you can (usually) only pull fields into your template from a single object — but as the OP alludes to above, the template builder doesn’t make this especially clear. The template builder lets you pull in fields from as many objects as you want, but when you go to actually send or preview the template, only fields from one object will actually populate.
…usually.
Take a look:
The Old Workaround
Back when this idea was created, the commonly accepted workaround — really, the only workaround available to non-coding admins at the time — was to create cross-object formula fields. These worked fine, but they cluttered up objects with a bunch of formula fields that served no purpose other than to be used in an email template.
And there was a catch. Formula fields could only pull in data from related objects going *up* the data hierarchy, e.g. from a parent object. If you wanted to pull in fields from any related object going *down* the data hierarchy (e.g. from child objects), you’d either need to create a roll-up summary field (if you were lucky enough to have that work for your use case), or you’d have to create a new, blank field to hold the data from your child object, populate it, and build out a whole automation to keep it updated.
But no longer…
An Alternate Route
…because today, you can use a flow instead!
Nowadays, whenever I need to build an email template that pulls in fields from multiple related objects, I skip the email template builder altogether and create the template directly in flow builder instead.
To demonstrate, let’s revisit the sample template from our previous video, this time building the email template directly in a flow:
The example above pulls in data from the target object and its parent object, but you can use flow builder to pull in data from child objects as well.
To see an example of how to get data from child records, check out my Mile High Dreamin’ conference presentation here to learn how to use the Loop element to do just that. (In that presentation, I populate a variable called “ingredientList” to ultimately update a record. Instead of updating a record, for this use case, you would use that same “ingredientList” variable in your Text Template.)