Updating Contacts through Email Sends

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:

LastEmailDate (date)
LastEmailTo (email)


We’ll use our first process builder to populate these two fields.

Step 2: Email Message Process Builder

Create Process Builder on the Email Message object
Evaluate when record is created
For the criteria, include this line first:
RelatedToID starts with ID 001
Include any other criteria if you only want to update the contact when specific emails are sent, for example ‘Register for New Product Webinar!’

For our immediate actions, we’ll update the Related To Account.

Update Related Records: Related to Account

For the field updates:
LastEmailID field reference EmailMessage.Id
LastEmailTo field reference EmailMessage.ToAddress
For this to work, emails must be related to an account prior to sending. 

Step 3: Account Process Builder

Create Process Builder on the Account object
Evaluate when record is created or edited

For the criteria, we’ll use the following formula:

OR(AND(IsBlank(PriorValue(LastEmailID)),Not(IsBlank(LastEmailID))), IsChanged(LastEmailID))
This will make our second process fire when the LastEmailID is populated for the first time or when its changed.

For our immediate action, we’ll update our related contacts.

Update Related Records: Contacts
Critieria for update:
Email = Account.LastEmailTo

Field Update
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.


Leave a Reply

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