Use Case: Update Contact After Logging Emails Or Calls
When I was a Salesforce admin, people asked me many times if we can roll the information of activities up to the contact level. It will be a dream if the roll-up summary can handle that, but it is not possible because activities and contacts do not have a master-detail relationship. It is feasible through some 3rd-party apps, but I haven’t found any that meets my need and is easy to use. (Open for suggestion here!!) So let’s build the solution with flow!
Now many of you might have the solution for calls (Task object) already because there is a lookup (contact) field. We can handle this easily with Process Builder. However, email is really the big problem as they are now a separate object called Email Message. When you check the object, you can’t see the contact lookup either. In fact, there is a junction object called “Email Message Relation” that connects the email and the relevant personnel.
This makes it impossible to build the solution in Process Builder, thus a very good example of what flow can achieve.
* Big thanks to Zhizhi Gabanna for sending in the case!
|See fields explanation of:|
|Email Message Relation|
Lulu Mobile wants to track how fast their salespeople reach out to the newly-created leads or contacts. They have a field called “First Followup Date”, and they want the system to populate this field whenever they send out an email or log a call. Since it is the first followup date, they only want to update it when the field is not empty.
For calls (Task Object), it is very easy to achieve using Process Builder. For emails, we can only use Flow. To demonstrate, we will build both solutions using Flow. If you want to count Events in, simply clone the flow for Task and change the object to Event.
We will use Record-Triggered Flow to make this happen. The solution will work for both Lead and Contact objects.
Flow 1: Update Lead/Contact When Task Is Logged
Flow 2: Update Lead/Contact When Email Is Logged
Please wait while flipbook is loading. For more related info, FAQs and issues please refer to DearFlip WordPress Flipbook Plugin Help documentation.
|Get Records||Update Records|
Does the solution solve your problem? If not, write us what your problem is and we will build the flow for you!
Wow! Excellent resource! Thank you for working this out. Well done!
Brilliant stuff, and very timely, having worked the last 2 weeks on increasing activity views in opportunities this is perfect, with a slight tweak and adding a formula element to plus one to a number field each time the flow completes I now have a live engagement counter on each opportunity. Thank you.
No problem at all. So glad to hear that it helps and that you even made your own customization!
Email flow#2 described above is not working for Lead. Did that work for you?
Yes it is working for my lead object as well. I would recommend checking again if all the elements are configured correctly. Otherwise feel free to send me some screenshots through emails so we can troubleshoot together.
I have had something similar in place and now it does not seem to be working, so trying your approach with the Email Message Relation object. My question, you are only checking the ToAddress, what about logging emails when the Contact is sending the email to the user? Would you recommend two paths or two separate flow to check for Contacts / Leads associated with the ToAddress field?
Hi Brian, I would recommend having them in the same flow, but have different paths as you suggested. The field we are updating here is the date when internal users reaching out to Contacts, so we only look at ToAddress.
If you want to update the field that indicates Contacts/Leads reaching out to Users, you would need to add another Get Records to get the FromAddress Relation. Then your Decision outcomes should be:
You can use the prefix to write these four outcomes.
Hope this helps!
The flow wasn’t working for me. When I am checking the email message record, the related list “Related To” is empty. Is there any chance you could take a look at it with me?
Hi Niko, of course. If you can write me about what you are trying to achieve and what’s not working, we can troubleshoot together.
The Related to list will only show the non-human objects (Account/Opportunity, etc). Leads/Contacts/Users will show up in “Sender and Recipients”.
Let me know what the issue is and let’s check together:)
Thank you for this post and the absolutely fantastic website! While the content here no doubt helps advanced admins hone their skills and covers a wide range of use cases, I think the best benefit is enabling beginners to reach a critical mass of confidence and knowledge to figure things out on their own. Flowsome bridges the gap between Trailhead and the real world.
Thanks so much for your kind words Gerald. Really appreciate it!
Thank you for this amazing guide. I wrote my first flow today (Yeah, I’m pretty late to the party) and understood each step perfectly.
That’s great to hear!! Good luck with all the future building!
Thank you for these awesome tutorials, @melody! These are phenomenal.
I am pretty new to SF so I apologize! I’m not able to get a successful flow from this. Granted, my flow is not 100% identical but very similar.
I have a “Last Contacted” date on the Entity/Account record. My goal is for that to update whenever an Email is sent or a Call is logged. I’m not getting any flow run errors, but the date field still does not update. Any ideas??
Here are some screenshots of my flow
Thanks so much for this! Very helpful. I do have a question on whether this will work if a single email is sent to multiple Contacts or Leads via Outlook and synced to SFDC using Inbox. I want to be able to update a date field on all Contacts and Leads that were sent the one email. Will the record triggered flow on Email Message created get triggered for each Lead or Contact on the To: and CC: lines of the email? I was wondering because the RelationType is set to “ToAddress”.