How to Use Salesforce Email Merge Fields to Personalize Every Email
Sending the same generic email to every contact in your Salesforce org is one of the fastest ways to kill engagement. salesforce email merge fields fix that. They let you pull live CRM data directly into your email templates so every message feels personal, without writing each one by hand.
This guide covers everything you need to know: what merge fields are, how to add them in both Classic and Lightning, the most useful field types, why they sometimes go blank, and how to push personalization further when native Salesforce hits its limits.
What Are Salesforce Email Merge Fields?
A merge field is a placeholder in an email template that Salesforce replaces with real record data at the moment the email is sent. Instead of writing "Hi Sarah" manually, you insert a merge field once, and Salesforce fills in the right name for every single recipient automatically.
They work across every sending context in Salesforce, including one-to-one emails sent from a record, workflow email alerts, Flow-triggered sends, approval process notifications, and bulk campaigns. The field resolves against whichever record is associated with the email at send time.
Simple example of what a merge field looks like in a Classic template:
Hi {!Contact.FirstName}, just following up on {!Opportunity.Name}. Looking forward to connecting!
When sent, Salesforce replaces those placeholders with the actual contact's first name and the opportunity name, automatically, for every recipient on the list.
Classic vs. Lightning: Two Different Syntaxes
The most important thing to know before inserting merge fields is that Salesforce Classic and Lightning use completely different syntax. If you mix them up, the field fails silently with no error message, leaving a blank space in your sent email.
Classic Templates: Salesforce Merge Language (SML)
Classic templates use curly braces with an exclamation point:
{!Object.FieldName}
The most commonly used SML fields are {!Contact.FirstName} and {!Contact.LastName} for recipient personalization, {!Account.Name} for the related account, {!Opportunity.Amount} and {!Opportunity.CloseDate} for deal context, {!Case.CaseNumber} for support workflows, and {!User.Title}, {!User.Email}, and {!Organization.Name} for sender and org details.
Lightning Templates: Handlebars Merge Language (HML)
Lightning templates use triple curly braces and organize fields into four categories: Recipient, Sender, Organization, and Related Entity.
{{{Category.FieldName}}}
The equivalent HML fields are {{{Recipient.FirstName}}} and {{{Recipient.LastName}}} for the contact, {{{Sender.Email}}} and {{{Sender.Title}}} for the sending user, {{{Organization.Name}}} for the org, and {{{RelatedTo.Amount}}} for related record values like opportunity amounts.
How to Insert Merge Fields in a Lightning Email Template
Go to the App Launcher and search for Email Templates. Open the template you want to edit.
Make sure the Related Entity Type is set correctly. This determines which Recipient fields are available.
Click inside a Rich Text component in the template body.
Click the { } icon in the bottom-right corner of the editor. The merge field picker opens.
Select a category: Recipient, Sender, Organization, or Related Entity. Then choose the specific field.
Click Insert. The field appears in your template.
Add fallback text to handle blank values. For example: {{{Recipient.FirstName|there}}} renders "there" if the first name field is empty.
Use the live record preview to confirm all fields populate before saving.
How to Insert Merge Fields in a Classic Email Template
Go to Setup → Communication Templates → Email Templates.
Open or create a template (Text, HTML with Letterhead, or Custom HTML).
Place your cursor where you want the dynamic value to appear.
Use the Available Merge Fields dropdown or Insert Merge Field tool. Select Field Type, then the specific field.
The field is inserted in {!Object.Field} format.
Use Send Test and Verify Merge Fields to test with a real record before using in automation.
Key rule for Classic: merge fields only resolve against the template's primary object. If your template is linked to the Contact object, {!Contact.FirstName} works. {!Account.Industry} does not. You would need a formula field on the Contact that references Account.Industry first.
Real-World Merge Field Examples
Sales follow-up:
Hi {!Contact.FirstName}, I wanted to follow up on {!Opportunity.Name}. Given the timeline, I think we can close this before {!Opportunity.CloseDate}. Feel free to reach me at {!User.Phone}.
Support case update:
Hello {!Contact.FirstName}, your case #{!Case.CaseNumber} ({!Case.Subject}) has been updated. Your assigned rep is {!User.FirstName}. Reply to this email or contact them at {!User.Email}.
Renewal reminder:
Hi {!Contact.FirstName}, your account with {!Organization.Name} is coming up for renewal on {!Opportunity.CloseDate}. Let's make sure everything is in order.
Why Merge Fields Show Up Blank (And How to Fix It)
Blank merge fields are the most common complaint from Salesforce admins using email templates. Almost every case comes down to one of four causes.
Syntax error. A stray space like {! Contact.FirstName} or a missing curly brace breaks the field silently. Always use the picker, never type syntax manually.
Empty field on the record. If a Contact has no First Name entered, the merge returns blank. Add fallback text, or run a data quality check before sending campaigns.
Wrong object association. If your template is set to the Lead object but you're sending from a Contact record, nothing resolves. Make sure the template's Related Entity Type matches the object you're sending from.
Field-level security. If the user running the automation doesn't have read access to the field, Salesforce returns an empty value with no error. Check the permission set or profile of the running user.
Merge Fields in Automation: What Works Where
Not every template type works in every automation context. This trips up a lot of Salesforce users. Workflow Rules, Process Builder, and Approval Process Alerts all require Classic templates with SML syntax. Flow's Send Email Action also works best with Classic. One-to-one emails sent directly from a record and bulk campaign sends support both Classic and Lightning. If you are building automated email journeys through Flows or workflow rules, Classic templates remain essential, even if your entire org has moved to the Lightning UI.
The Cross-Object Limitation
Native Salesforce merge fields only pull data from the template's primary object. You cannot reference a parent or related record directly. {!Contact.Account.Industry} will not work in a standard template.
The workaround is creating a formula field on the Contact object that references Account.Industry, then using {!Contact.Account_Industry__c} in your template. It works, but it adds a formula field for every cross-object value you need, and the maintenance overhead adds up quickly as your email program scales.
For teams that routinely need data from related accounts, parent opportunities, or custom objects in their emails, this is the most significant limitation of native Salesforce email personalization, and worth knowing about before you build out a complex template library.
Top comments (0)