PB+Flow: How to Conquer a Challenge

Process Builder and Flow have become really good friends of mine lately. When you combine PB+Flow, you have a great way to overcome some of the challenges out of the box functionality gives to a solo admin stuck on Classic with no developer. Walk through this one with me, will you?

Business Requirement: A Task Record Needs to Trigger an Email to a Customer

The challenge here is complex. It sounds so easy, you have an Activity with a subject that equals “xyz” and a Workflow Rule that sends out an email when that activity is created, right?


Wrong! Activities (including Tasks and Events) have a “related to” field; however, workflow rules with an email alert cannot reference the email address of the “Related Contact” on an Activity. See there on the left? There are no available recipients to chose from!



A standard Process Builder by itself must look to the same logic because you cannot fire an email alert to the Related To, either. You can get to the “Related To Id”, but can’t dig down another level. By the time I figured this out, I was frustrated that I’d said yes to what sounded like a simple requirement to trigger an email when an activity was logged!



My last straw option was Flow. I’m working on my confidence with it (and explanations like this one from Kristi help immensely), but still need to brush up on my skills. Doing some research, I found that Flow can send emails, but only through the same logic as the two issues above (Email Alert)…or wait…does it actually have another magical option?

PB+Flow: How to Conquer a Challenge

Luckily, Flow has another way to send emails – the Flow Send Email Element. Granted, this solution was a bit grainy (because “The email is treated as plain text; HTML formatting isn’t respected.”) and cannot use email templates. Goodbye to our company branding and hello to plain text. I got this to pass by my stakeholders and went to work configuring the Process Builder and Flow.

I needed Process Builder to trigger the flow, so I set up my launch to happen when an Activity was created with a specific subject and fill in the Id of the Task (WhatId) and the Id of the Contact that the Activity was Related to (WhoId) when launching the flow. Why on earth it cannot use the WhoId for the “send email” function is beyond me.

The Flow then has to use the WhoId to look up the Contact and get the email address and assign it to a variable EmailForSendTo which is referred to later in the Flow.



My Flow does use the email alert function to send a pretty email template version to the owner of the Contact for bonus points, but it seems like some gold-plating since it’s an internal alert. I did it anyways like a good Admin does! (This is found in the Email Alerts section of the Flow Palette, DM me @beckywillispro if you aren’t sure where to find this – I’m keeping a few things secret sauce).

To get the email to the Customer, I had to use the Send Email Static Action. I had to create a Text Template for the Body and the Subject and then reference them in this element. The variable EmailForSendTo comes into play here where I call it to get the data pulled in from the Id that was referenced in the Process Builder. Hence, PB+Flow for the win.

WARNING: When you send the email from the User trigging the Process Builder (in this case, the User who created the Activity, a Customer), you risk the email being flagged as potential spam (yup, that happened on my first live test of this…Google was not happy with what I’d sent because it looked like it was from me but then included a bunch of those infamous Salesforce garbly-gook characters on email addresses. Luckily, the way around this was to use the DefaultWorkflowUser.

Figuring this out was exhausting and rewarding – you know how that goes. When you conquer a challenge like this, be sure to tweet it and @mention us so we can cheer you on. Who knows, you might even earn yourself a guest post to come over here and explain it to the rest of us Accidentals!

What is a challenge you have conquered recently?

Are you attending Dreamfore and need to conquer your fear of Flow? I’ll be in the audience at this session, “No More Excuses, Today’s the Day You Will Learn Flow” with MVP Jennifer W. Lee.

Leave a Reply

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