Menu
subscribe our youtube channel popup

Lightning Email Templates in Salesforce

Lightning Email Templates in Salesforce provide an efficient way for users to create and manage email communications. They are modern and user-friendly, offering advanced customization and a drag-and-drop interface for creating visually appealing emails.

Features of Lightning Email Templates

1. Rich Text Editing

Allows bold text, images, and hyperlinks formatting options.

2. Dynamic Content:

Supports merge fields to personalize emails dynamically. Merge fields in Lightning Email Templates are placeholders that allow users to personalize emails by automatically inserting data from Salesforce records. The field to be referenced is written within curly braces ( {{{ }}} ). In the below example, {{{Recipient.Name}}}, {{{Recipient.Site__c}}}, and {{{Sender.Name}}} are the merge fields to reference the recipient’s full name, the site name related to the recipient, and the sender’s full name, respectively.

To add merge fields, place the cursor where the data is to be included. Click on the icon present in the bottom-right corner of the editor. You should be able to see a list of fields related to the recipient, sender, organization, and the related entity type mentioned. Choose the required field and click Insert.

3. Limitations

Cross-Object Restrictions: While Lightning Email Templates primarily support merge fields from a single object, there are workarounds to include cross-object data using formula fields. For example, if you need data from a related object, you can create a formula field on the primary object that references the desired field from the related object.

Lookup Relationships: Merge fields can reference lookup relationship fields but are limited to accessing only the name field of those relationships unless formula fields are employed

4. Folder Management

Organize templates into folders for better accessibility.

5. Enhanced Collaboration

Users can collaborate and share templates easily.

Classic Vs. Lightning Email Templates

 Classic Email TemplatesLightning Email Templates
User InterfaceSimpleModern with drag-and-drop capabilities
Formatting OptionsLimitedAdvanced with rich text and images
Merge Fields FunctionalityMerge fields are available but may require more manual setup and are less user-friendly.Provide a more intuitive way to insert merge fields directly into the email body, enhancing personalization.
CustomizationRequires coding for advanced designEasy customization through UI

Lightning Email Templates Example Scenario

Imagine there’s a tower building company called “Blucon”. Their requirement is to notify the landowners about the site inspection date and time via email.

ER Model:

Site is a custom object that stores data about a physical land that Blucon visits, inspects, and finalizes/rejects for building towers. Contact is a standard Salesforce object that is used to store the contact details of the landowners, in this case.

The solution we are going to build will automate the email whenever the inspection date is decided/changed in the Site object. Let’s take a look at it.

  1. Go to the Blucon app.
  2. Go to Object Manager from the Setup.
  3. Create a lookup field that points to the Site object (fieldname: Site) and a formula field that stores the tentative inspection date and time (fieldname: Tentative Inspection Date and Time) in the Contact object. Add only the lookup field to the page layout and let the formula field be hidden as it has been created only to overcome the cross-object restriction.
  4. Create a lookup field that points to Contact (fieldname: Landowner) in the Site object.
  5. From the App Launcher, search and open Email Templates.
  6. Click New Email Templates.
  1. Fill up the details and click Save.
  1. Now we have a lightning email template ready to use.

Let’s build a flow to automate the email with the above-designed template. Whenever there is a change in the field ‘Tentative Inspection Date’ while the ‘Inspection Status’ field’s value is ‘Yet to be inspected’ in the Site object, an email is to be sent to the respective landowner about the inspection date and time. Let’s follow the below steps to create a flow for this.

  1. Go to Setup.
  2. Type Flows in the Quick Find box and go to Flows.
  3. Click New Flow.
  1. Select Start from Scratch. Click Next.
  2. Choose Record Triggered Flow and click Create.
  3. Configure the Start:
    1. Object: Site
    1. Trigger the flow when: A record is created or updated
    1. Entry Conditions:
      1. Condition Requirements: All conditions are met (AND)
      1. Conditions:
FieldOperatorValue
Inspection_Status__cEqualsYet to be inspected
Tentative_Inspection_Date__cIs ChangedTrue
  1. When to run the flow for updated records: Every time a record is updated and meets the condition requirements
    • Optimize the flow for: Actions and Related Records
  2. Now add a Send Email action to the Start element. Click on the plus icon below the start.
  3. Click Action. On the Search Actions panel, type Send Email and select Send Email action.
  1. Name the action.
  1. Include and set the following email input values:
    1. Email Template ID: <TheLightningEmailTemplateID>
    1. Recipient ID: Triggering Site__c > Landowner > Contact ID ({!$Record.Land_Owner__r.Id})
  1. Save and activate the flow.
  2. To test the flow, open a Site record that is related to a particular contact.
  3. Set the fields ‘Inspection Status’ to ‘Yet to be inspected’ and ‘Tentative Inspection Date’ to a date in the future.
  1. After saving the record, open your email inbox. An email should be in the designed format (if the email is not in the inbox, make sure to check the spam folder).

Viola! We are done with sending emails automatically to the landowners when the site inspection date is decided. Likewise, you can automate emails when an inspection is done (for sending reports within the internal team) and the site is finalized or rejected (sending confirmation to the landowner as well as the team).

Conclusion

Email Templates in Salesforce are indispensable for businesses aiming to streamline communication and maintain consistency. Salesforce Lightning Email Templates represent a significant advancement over classic email templates, offering enhanced customization, ease of use, and greater engagement potential. By leveraging these tools, organizations can improve their communication strategies and foster better relationships with their customers and stakeholders.

Sheima Latha J
Sheima Latha J
Articles: 20

Leave a Reply

Your email address will not be published. Required fields are marked *