Sneaking Dynamic Data into Email Templates with Send Rich Email

As discussed in the Email Templates section of the Send Rich Email action, Salesforce Lightning Email Templates have an ability to merge data in dynamically, but it’s limited. You can only merge in fields from a core set of supported Standard records: Lead, Contact, User:

What if you want to merge in additional dynamic data? You can do it using Flow.

The basic idea is that you create one or more custom fields on Lead, Contact, or User to serve as temporary holding pens for dynamic data. Then in the same Flow that you use to send the email, you update the record with your dynamic data. After you send the email, you can choose to erase the data from the custom field.

Example: you want to add a Price quote to an Email that’s sent to Contacts. You add a custom field to Contact. You could be specific and call it PriceQuote__c but we’ll be more general purpose and call it FlowMergeField1__c so we can use it for different purposes. Over in Lightning Email Template, add the field to your email body or subject:

In the Flow, take the contact record and do an Update Records setting the value of FlowMergeField1__c to the price you want inserted in the email.

You then need to make sure that the database commits your change before you call Send Email. Any Screen will cause a commit, so you could insert a screen that says “Click next to send”, and it would commit your update. You can eliminate that step with the Commit Transaction action if you’re using a Screen flow, and with a Pause element set to a zero time duration if you’re using an Autolaunched flow. Without this step, it still might work some of the time, but do this for reliability.

Then call your Send Rich Email action, passing it the ID of the template.