Last Updated on April 3, 2022 by Rakesh Gupta
Big Idea or Enduring Question:
How do you send custom email notifications for the completed tasks to the Assignor?
Objectives:
After reading this blog post, the reader will be able to:
- Create a record-triggered Flow to send custom email notifications for the completed tasks to the assignor
- Create an email template in Flow
- Use Send Email flow action
Business Use case
Warren Mason is working as a System administrator at Universal Containers (UC). He has received a requirement to send out an email notification for completed tasks to the assignor.
Automation Champion Approach (I-do):
A Salesforce Flow will automatically take action when a record meets specified criteria. It has a great capability to send out email notifications to a lot of different objects. This will allow you to notify a person or groups of people via email whenever it meets the evaluation and meets the conditions specified.
Salesforce doesn’t have out-of-the-box features to notify the assignor when the assignee completes a task. For example, let’s say the Sales manager (Daniela Ruah) assigned a task to a Sales rep (Jessica Smith) to follow up with one of her key customers to check the status of last quarter’s bills. By default, when Jessica completes the assigned task, Daniela (sales manager) will not receive any email notifications.
To solve this requirement, we will use the After-save Record-Triggered Flow. Check out this article to understand why we are using after-save record-triggered flow for this scenario.
Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes going through the following Flow diagram and understand it. Let’s begin building this automation process.
Guided Practice (We-do):
There are 4 steps to solve warren’s business requirement using Record-Triggered Flow. We must:
- Define flow properties for record-triggered flow
- Add a Text Template to construct the email body
- Add a decision element to check if the task owner and the assignor are not the same people
- Add a core action send email to send out an email
Step 1: Define Flow Properties
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows then click on the New Flow.
- Select the Record-Triggered Flow option, click on Create and configure the flow as follows:
- Object: Task
- Trigger the Flow When: A record is created or updated
- Set Entry Criteria
- Condition Requirements: None
- Optimize the Flow For Action and Related Records
- Click Done.
Step 2: Add a Text Template to Create Dynamic Email Template
Now we’ll create an email template using the Text Template. The text template allows you to specify the multi-line messages. It also allows you to use HTML code.
- Under Toolbox, select Manager, then click New Resource to create a text template.
- Input the following information:
- Resource Type: Text Template
- API Name: textT_EmailBody
- Select View as Rich Text
- Body
- Hi {!$Record.CreatedBy.FirstName},
- Task {!$Record.Subject} (https://myautomationchampion-dev-ed.lightning.force.com/{!$Record.Id}) is successfully completed by {!$Record.Owner:User.FirstName}
- Regards,
- Automation Champion
- Click Done.
Step 3: Using Decision Element to Check if Status is Completed and, Task Owner and Assignor is Not Same Person
Now we will use the Decision element to check the following:
- Task status is completed
- Task owner must be a Salesforce User
- Task owner and assignor is different people
- On Flow Designer, click on the +icon and select the Decision element.
- Enter a name in the Label field; the API Name will auto-populate.
- Under Outcome Details, enter the Label the API Name will auto-populate.
- Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
- Row 1:
- Resource: {!$Record.Status}
- Operator: Is Changed
- Value: {!$GlobalConstant.True}
- Add Condition
- Row 2:
- Resource: {!$Record.Status}
- Operator: Equals
- Value: Completed
- Add Condition
- Row 3:
- Resource: {!$Record.OwnerId}
- Operator: Start With
- Value: 005
- Add Condition
- Row 4:
- Resource: {!$Record.OwnerId}
- Operator: Does Not Equal
- Value: {!$Record.CreatedById}
- Row 1:
- When to Execute Outcome: If the condition requirements are met.
- Click Done.

Step 4: Add Send Email Action to Notify Assignor
Now we will use the Send Email static action to send out an e-mail to Assignor.- On Flow Designer, below the Completed node, click on the +icon and select the Action element.
- Search and select the Send Email from the dropdown menu
- Label the new action Notify Assignor
- Set Input Values
- Body: {!textT_EmailBody}
- Subject: Task Completion Notification – {!$Record.Subject}
- Email Addresses (comma-separated): {!$Record.CreatedBy.Email}
- Rich-Text-Formatted Body: {!$GlobalConstant.True}
- Click Done.

Once everything looks good, perform the steps below:
- Click Save.
- Enter Flow Label the API Name will auto-populate.
- Click Show Advanced.
- API Version for Running the Flow: 54
- Interview Label: Record-Triggered: Task After Save {!$Flow.CurrentDateTime}
- Click Save.
Proof of Concept
Now onwards if a user completes the task, the salesforce flow will notify the assignor.- Rakesh Gupta creates a Task and assigns it to user Jessica Brody.
- When Jessica completes the assigned task, Rakesh Gupta will receive the following email notification.

Formative Assessment:
I want to hear from you!
What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.
How I am able to add additional recipient just like email alert in Flow ? I am trying to use “Recipient Email Addresses (comma-separated)” option but it prompt me error that I am in an invalid email format. Currently under this section already have a Get Record resource created to grab the email from user in Account Team and I would like to add an additional email but not a user in Salesforce.
You have to try something like this:
1. Create a Text variable Collection
2. Add Account Team member’s email to the Text Variable
3. Add Text variable to Email Addresses (Collection) when using Send Email static action
4. Add Additional email to Email Addresses (comma-separated)
Hello Rakesh! Nice explanation. I have a question. Is it possible to send this email message to a queue?
Yes, if queue has an email address.
First of all Thank you for the detailed approach to explain the functionality.
I created a flow but Emails are not getting Delivered.
deliverability is set to all emails., Using API version 56
Check out this article on how to Troubleshoot Delivery Problems for Salesforce Emails.
is there a way to prevent hardcoding this URL (https://myautomationchampion-dev-ed.lightning.force.com/{!$Record.Id}) or saving it in a custom label and using in email body, that way when we deploy the email template from sandbox to production, the url will not break . ?
Yes, either use Custom Label or read this article to understand how to get base url https://automationchampion.com/2022/04/25/how-to-get-salesforce-org-base-url-in-flow-2/
Hello Rakesh. Thank you so much for this! One issue I’m coming across is when I enter {!$Record.CreatedBy.Email} in the Send Email action, it gives me an error saying “These issues don’t prevent activation, but can cause problems when you run the flow.
Notify_Task_Assignor (Action) – These email addresses are invalid: {!$Record.CreatedBy.Email} . Use this format: user@example.com.” Any idea of how to resolve this? Thank you again!
I tried in my developer org, and it didn’t give any error to me. Active the Flow and test it and let me know how it goes.
Thank you for the quick reply! No luck unfortunately. The flow is activated but when I had my co-worker mark the task as completed, no email notification came through. The flow won’t even let me save changes with {!$Record.CreatedBy.Email} inputted unless I add a space or comma at the end of it. And when I do that, it gives me the error I mentioned initially. Are there any workarounds that you’re aware of? Thank you again!
Please share send email and Flow screenshots with me.
Will do. What email address should I send the screenshots to? Thank you again for your time and help.
Check your email. I am happy to help.
Don’t copy and paste values from blog instead manually enter the value by clicking Record > Created By > Email.
It’s working now after changing the API version to 49 and updating the values. Thank you for your help and your excellent blog!
😊
Hello I have tried this but Using the “{!varRTask.CreatedBy.Email},” in the email of the flow gives out an warning message that the format should be xxx@xxx.com
Is it possible to send a screenshot to me?
Can you explain this..
Field: Task | OwnerId (assigned to? created by? last modified?)
Assigned To – Represent a Person or Queue to who owns the Task.
Created By – Person who creates the Task
Last Modified – The date and timestamp for changes made to an individual record, including the User who made the change.
This is so useful, Rakesh, thank you! (I just implemented based on a user recent request). A comment and a question. Task.OwnerId is the field ‘Assigned To’ of the Task object (I don’t know if this has changed overtime). The question I have is: on the email communication, is there a way to include the record name (e,g,, Campaign Name) the task is attached or related to?
Task.OwnerId is the API name whereas Assigned To is the Field label. If you want to include the record name, you have first to query the record details and then update the Text template.
Hi there! Can you re-do this for the new flow builder that just came out in Winter 19? It’s completely different!
Yes, but in a few weeks 🙂
Rakesh, Can you make the replies / comments editable/deletable?
Sorry I don’t have any idea
Okay. Thank you.
I got it. We are setting values to the variables in the process builder. I overlooked the process builder part.
Thank you, Rakesh. Never thought Flows are this simple.
In the Record lookup, It’s filtering based on Assignor Id and Assignee Id. ( Where Id Equals VarT_AssigneeID & Where id equals VarT_AssignorID). But where did you actually assign values to those variables? Don’t they contain ‘null’? Did you miss that part in this article?
Nope, we are passing the value to these variables via Process Builder
Thanks Rakesh for fantastic series! I was looking for this one from past few days. Keep up your good work.