Use the Salesforce Merge Language in Lightning Email Templates

Read these considerations for using merge fields from the Salesforce Merge Language in Lightning email templates.

Required Editions

Available in: Lightning Experience
Available in: All Editions

List email not available in: Personal, Contact Manager, and Group Editions

Note
Note

In Summer ‘18, we introduced the Handlebars Merge Language (HML) for email templates in Lightning Experience. If your email template has merge fields with three curly braces ({{{), you’re using an HML email template. If the merge fields have one curly brace ({), or an exclamation mark (!), you’re using a SML (Salesforce Merge Language) email template. Lightning templates created since Summer ‘18 are HML email templates.

Guidelines for Syntax and Formatting

The syntax consists of an open curly brace and exclamation point, followed by the object name, a period, the field name, and a closing curly brace. For example, if you want to include the account number of your recipient, enter ID: {!Account.AccountNumber}, and the recipient’s email displays ID: 001234567890123 when you send or preview it.

To make sure you’re using the correct syntax, select merge fields from the merge field picker.

Important
Important
  • If two or more custom objects have matching names or labels, only one of the objects appears when you select from available merge fields. Make sure that all custom objects have unique names and labels so that you can select merge fields from any of the objects.

Guidelines for Using Merge Fields

In Lightning email templates, merge fields defined for an object that doesn't match the recipient or Related To record don’t have any value.

Note
Note Enhanced letterheads support the Handlebars Merge Language only.

If you use a merge field for which there’s no data in a particular record, that field doesn’t appear in the sent email.

The following types of merge fields aren’t supported in Lightning email templates:

  • {!Receiving_User.field_name}
  • {!Sending_User.field_name}
  • {!BLANKVALUE(Contact.FirstName, "Valued Customer")}
  • {!Contact.FirstName, Valued Customer}
  • Campaign merge fields (can’t be used in list emails)
  • Email message merge fields