Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full Merge Field entry
How-to guide

Use Merge Fields in an email template

The most common use of merge fields is personalizing email templates. The pattern is the same across Classic and Lightning email templates.

By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated May 21, 2026

The most common use of merge fields is personalizing email templates. The pattern is the same across Classic and Lightning email templates.

  1. Open the email template editor

    Setup, Communication Templates, Email Templates (Classic) or Lightning Email Templates (Lightning). Create or edit a template.

  2. Pick the related object

    The template targets a source object (Contact, Lead, Opportunity). The merge fields available depend on this choice.

  3. Insert merge fields

    Use the merge-field picker (typically a dropdown or toolbar button). Pick the field; the editor inserts {!FIELD_API_NAME}.

  4. Test with a sample record

    Send a test email to yourself targeting a real record. Verify every merge field resolves correctly.

  5. Handle null values gracefully

    For fields that might be null (middle name, suffix), wrap in IF() or BLANKVALUE() to avoid broken-looking output.

  6. Save and activate

    Save the template. Activate it for production use. Train users to pick the right template per scenario.

Mandatory fields
Source objectrequired

The object whose fields are available as merge fields.

Merge field syntaxrequired

{!FIELD_API_NAME} or {!OBJECT.FIELD_API_NAME}.

Cross-object traversalrequired

Up to five levels through lookup relationships.

Null handlingrequired

Use IF() or BLANKVALUE() to handle missing values.

Gotchas
  • Merge fields fail silently on null. Test with real records to catch broken output.
  • Cross-object traversal is capped at five levels. Beyond that, restructure the data model or use Apex.
  • The merge-field syntax varies slightly across surfaces. Formulas use direct field names; templates and Visualforce use {!}; check the surface-specific documentation.
  • Lightning Email Templates and Classic Email Templates use the same syntax but render differently. Test in both contexts when migrating.

See the full Merge Field entry

Merge Field includes the definition, worked example, deep dive, related terms, and a quiz.