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:
- Email Message (this creates the email message record)
- 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.
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.
- Screen to collect contact info including email.
- Create Records to create Contact based on info in the screen.
- Send email action.
- Create Email Message.
- 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!