Log Email Sent Through Flow on a Contact Record

Shows the activity timeline of a contact record with one email message stored there sent at 2:46pm today with subject "Welcome to the family, Jemma!"
Log an email message on the contact record like this one.

UPDATE SUMMER ’23: This is no longer necessary! Read here.

When sending email from a contact record, it magically logs the message to your activity log. In classic, emails were/are automatically logged to the Activities related list. Well, flow doesn’t do that for you. Let me show you how to log it so you and your colleagues know when an email was sent to a contact.

After you add a “Send Email” action to your flow, add two more Create Records elements to the canvas. You will create records of these objects:

  1. Email Message (this creates the email message record)
  2. Email Message Relation (this junction object connects the email message to the contact).

Record Triggered Flow Scenario

See the images and video below for how to add your objects and map your fields.

  • flow canvas with four elements "Record Triggered Flow Start" points to SendEmailAction. That points to two elements which are circled "EmailMessage" and "EmailMessageRelation"
  • Field mapping for email message object.

I use text templates for the email body and the subject. This allows me to use merge fields and easily re-use the body and subject in multiple elements.

My example flow above is a record-triggered flow that fires when a contact is created. Because of this, I use $Record > Contact ID to access the id of the contact and $Record > Email to access their email. $Record is the global variable that stores all the information about the record that fired the trigger.

Screen Flow/Create Records Scenario

Let’s look at another scenario.

  1. Screen to collect contact info including email.
  2. Create Records to create Contact based on info in the screen.
  3. Send email action.
  4. Create Email Message.
  5. Create Email Message Relation

The create email message element will be exactly the same. The create Email Message Relation element will be slightly modified to access the right values. The Relation Email Address will be populated by the email address entered on the screen. You’ll find that under Screen Component. Click “Email” and select “Value.”

The RelationId will be set to the ID of the contact created in the previous step.

Both of these scenarios should work with lead records as well!

Published by


Jessie joined Salesforce.org in 2018 to give introductory webinars to nonprofit customers. She now is a Senior Solution Developer supporting nonprofits and education customers at Salesforce. All opinions expressed on this blog are her own or those of the contributors. She's spent 17 years more or less in CRMs and databases, but didn't meet Salesforce until 2011. Jessie co-led the Seattle Salesforce Nonprofit User Group in 2015-2016. She wrote a sh*tty first draft of a novel and hopes to turn it into a screenplay!

27 thoughts on “Log Email Sent Through Flow on a Contact Record”

      1. Hi,
        I follow the same thing but I am unable to see the emailbody as rich text in activity. Please suggest me something.

  1. Wow, I just started looking for solutions for this very dilemma, and low and behold! Thank you for sharing!

      1. Love this thanks – would the create email message record work with an email alert or would you need to create mimicking variables ?

      2. I don’t know how it works with email alerts but please let us all know if you try it!!

  2. Jessie,
    Thank you so much for posting this! It is hugely helpful and I was able to use this in a new flow in my environment.

    How can I make this work for an existing flow that uses Email Alerts and Lightning templates?

    1. It can work. You’d just need to copy the email template to a text template to store the content

  3. Hi Jessie, I wish I would have found this page before building the same flow for a client. I am still trying to solve a problem though if you can help. I am looking for a way to track the emails sent using this flow. So far research says it’s not possible, but let me know your thoughts.
    Thanks in advance.

      1. By track I mean status if it is delivered, opened, unopened etc. Manually sending the email from Activity automatically tracks the email but through flows it doesn’t. I see there’s an idea on salesforce for this, but I am trying to see if there’s a workaround or a hack for this.

      2. Hi Jessie, it’s me, Sandy! I love this post, but I have an outstanding question just like Sanket. I have email tracking enabled in my org, so it shows if an email was opened by the recipient. Your solution above works, but in my testing, when the email is opened, it does not show as opened in Salesforce. Any thoughts? Thanks

  4. Hi guys, I am also interested in a solution to tracking the opened, unopened status of an email sent from a flow.

  5. Thanks a lot for this wonderful solution, Jessie. It worked like a charm! This is exactly what I was looking for. Thanks once again.

  6. Hi JessieRymph I’m trying this on account record to send emails all related contacts. My problem is your solution is working for single contact . If I select multiple records it’s throwing error. Can you please suggest me. Thank you .

    1. You would most likely need to use a loop. I am not exactly sure how but that’s my initial thought

  7. When I try to create an Email Message I get an error the ParentID is required. Even populating that ID with a Case (the only option), it does not relate my new message to my Lead. Any thoughts?

  8. If anyone encounters the same problem – I did everything right (or so I thought) but the message was still not appearing in the Contact activities. Turns out I forgot to set a Status to ‘Sent’ in the Email Message object. It was saving in Draft so it wasn’t appearing on the Contact. 🙂

  9. Hi, is it possible to user create record under EmailMessage object and pass body, subject and other fields when I am using Email alert under flow ? because I have to create too many Email template? The only way to create record under emailmesssage object and pass body subject is only through text template ? can anyone please confirm

Leave a Reply to Samantha ShainCancel reply