This was an interesting problem I came upon in the answer community – a user was attempting to update a contact after sending an email but was not having any success. Through a few iterations, we found that when using Enhanced Email, while an EmailMessage record and Task record are created, a workflow or process builder will only trigger on the EmailMessage record, not the task record.
Also, while EmailMessages can be related to various objects, the To field is text only, meaning the related contact or lead is not available to update from an email message record, so to solve this, we used to process builders to able to update the related contact.
Our solution is below.
Step 1: Create Custom Fields
First, we need a few custom fields to support our process flows. On the account object, create two custom fields:
We’ll use our first process builder to populate these two fields.
Step 2: Email Message Process Builder
RelatedToID starts with ID 001
For our immediate actions, we’ll update the Related To Account.
Update Related Records: Related to Account
LastEmailID field reference EmailMessage.Id
LastEmailTo field reference EmailMessage.ToAddress
Step 3: Account Process Builder
For the criteria, we’ll use the following formula:
For our immediate action, we’ll update our related contacts.
Update Related Records: Contacts
Critieria for update:
Email = Account.LastEmailTo
Update your targeted field
This field update will only impact the contact with the matching email address as the To field on the EmailMessage record.