Jenwlee's Salesforce Blog

Log an Email Sent via Email Alert to the Activity History

There may be situations in which an email is sent via an email alert that you would like to log as an activity. Currently, the emails alerts are not logged as an activity history. To bridge this functionality gap, we can create an email message record once the email alert is sent when a case is closed using process builder.

Note: You can only use the text email version of the enhanced email message and not the HTML version of the email. This is currently a limitation of creating new email messages via Process Builder.

Here are a few lessons learned from implementing this use case:

Business Use Case: Addison Dogster is a system administrator at Universal Container. Sally Sunshine is the Operations Manager. Sally would like to log all customer interactions as an activity, including systematic emails that are sent. Currently, a customer receives an email when the case is closed but there is no record of this email sent to the customer in the customer’s or case’s activity history. 

Solution: Being the Awesome Admin that she is, Addison is able to solve this declaratively using process builder to mimic the email alert to log in the activity history.

Quick Steps:


Confirm that Enhanced Email is enabled in your org.

Note: You can confirm this in Salesforce Classic in Setup via Customize | Email | Enhanced Email. In Lightning, you can confirm this setting via Email | Enhanced Email.

The email template, email alert and process to send the email when the case is closed have already been created in the org.

1. Since our email message as mail merge fields in it, we will need to chunk out the email message into several text entries using Custom Labels.

In Classic, Custom Labels is found under Create | Custom Labels. In Lightning, you can find it under User Interface | Custom Labels. When in doubt, use the Quick Find.

This is the email message we need to reproduce:

Hi {!Contact.FirstName},

Your Case {!Case.CaseNumber}: {!Case.Subject} has been resolved.

If you believe this was closed in error, please contact us at 1-800-555-5555.

Thank you,
Universal Containers Customer Support

You will create 4 custom labels:

Your Case”

Here is the end result…

2. Now, let’s update the existing process builder. Locate the process by going to Create | Workflows & Approvals | Process Builder in Salesforce Classic or Process Automation | Process Builder in Lightning Experience.

A. Locate the existing process called “Take Action on New/Existing Cases,” click on the process name, then click on the Clone button.

B. Let’s add a new immediate action in the existing solo criteria node.

Here are the steps as shown in the animated gif.

C.  Click on the Activate button to activate the process builder.

That’s it! Congrats! You’ve implemented a process to log an email when an email alert is sent to the customer.

Now, before you deploy the changes to Production, you need to test your configuration changes.

  1. Create a contact.
  2. Create a case from the contact record. Ensure there is a subject.
  3. Close the case.
  4. Confirm that the email is logged in the case’s Activity History.

Deployment Notes/Tips: