Loading
Salesforce Enforces New Security Requirements in Summer 2026Read More
Extend Salesforce with Clicks, Not Code
Generate Emails From Records

Generate Emails From Records

A merge field is a field you can put in an email template, mail merge template, custom link, or formula to incorporate values from a record. For example, you can place a merge field in an email template so that the greeting includes the recipient's name rather than a generic “Hello!”.

Required Editions

Available in: both Salesforce Classic and Lightning Experience
The available merge fields vary according to which Salesforce edition you have.

You can use merge fields within custom formula fields, s-controls, custom links, custom buttons, Visualforce pages, and when you create email or mail merge templates.

Merge field names are determined when you create a custom field or object. Field Name is automatically populated based on what you type into Field Label. You can customize this field if you want, but keep in mind that the name must:

  • Only use underscores and alphanumeric characters
  • Begin with a letter and end with a letter
  • Not include spaces
  • Not contain two consecutive underscores
Important
Important

Ensure that the custom field name and label are unique for that object.

  • If a standard and custom field have identical names or labels, the merge field displays the custom field value.
  • If two custom fields have identical names or labels, the merge field can display an unexpected value.

If you create a field label called Email and a standard field labeled Email exists, the merge field is unable to distinguish between the fields. Adding a character to the custom field name makes it unique. For example, Email2.

To find the merge field name for an object or field in Salesforce, visit the object or field’s detail page and refer to Field Name.

To incorporate merge fields, use the editor in the respective feature. Salesforce provides valid merge fields in each editor for all related standard and custom objects. If you’re using the Connect for Office Word add-in to create mail merge templates, you see a complete list of valid merge fields to insert.

  • Merge Field Syntax
    A merge field’s syntax can vary depending on where you use the field. To make sure that you use the correct syntax, select merge fields from the dropdown list in the editor where you use the merge field.
  • Merge Fields for Validation Rules
    A merge field is a field you can put in an email template, mail merge template, custom link, or formula to incorporate values from a record.
  • Merge Fields for Formulas
    A merge field is a field you can put in an email template, mail merge template, custom link, or formula to incorporate values from a record.
  • Merge Fields for Cross-Object Formulas
    A Cross-object formula is a formula that spans two related objects and references merge fields on those objects.
  • Merge Field Tips
    Here are a few pointers for getting the most out of merge fields.
 
Loading
Salesforce Help | Article