A workflow rule or Process Builder 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 when ever it meets the evaluation and rule criteria. Unfortunately, similar functionality does not exist for Tasks and Events objects. In this article, I am going to discuss, how you can use Flow and Process Builder to overcome this limitation. Let’s start with a business use case
Business Use case
Warren Mason is working as System administrator at Universal Containers (UC). He received a new requirement to send out an email notification for completed Tasks to the assignor.
Solution for the above business requirement
There are a few possible solutions for the above business scenario, but I’ll use Process Builder and Flow to solve the above business requirement. You can also use Apex Triggers to resolving the above business use case. Follow the below instructions to create a Flow to solve the above business requirement
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open Flow canvas for you. Now create the few Text variables in the Flow VarT_AssigneeID, VarT_AssignorID, VarT_AsignorIDEmailAddress, VarT_AssignorFirstName, VarT_AssigneeFirstName, VarT_AssigneeLastName, VarT_Subject and VarT_ActivityID to store the data.
3. Drag and drop Record Lookup element (Enter the name To get Assignee details) on the canvas to get the Assignee First Name and Last Name, as shown in the following screenshot
4. The next task is to get Assignor details. For this drag-and-drop a Record Lookup element (Enter the name To get Assignor details) on the canvas to get the Assignee First Name and Email Address, as shown in the following screenshot
5. Now we’ll create an email template using the Text Template. Navigate to the Resources tab and add one Text Template to create an e-mail template. Design it as per the business requirements, please refer the following screenshot for more information
- Visual Flow Text Templates also allow you to use HTML code.
6. Now we will use the Send Email static action to send out an e-mail to Assignor. Navigate to the Palette tab and drag-and-drop the Send Email static actions onto the canvas. Please refer the following screenshot for more details
7. Finally, your Flow will look like the following screenshot
8. Save your flow with name Email notification for Completed Tasks and close the canvas. Don’t forget to Activate the Flow.
Launch a Flow from Process Builder
Our next task is to create a Process Builder on the Task object to launch a Flow. To create a Process on the Task object follow the below instructions
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder and click on the New button, Enter Name, API Name and then click on the Save button
2. The next step is to add entry criteria. For this click on Add Object, select Task object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button
3. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [Task].Status Equals Completed), also select the check-box Do you want to execute the actions only when specified changes are made to the record? and click on the Save button, as shown in the following screenshot
4. The next step is to add an Immediate action to Process. Click on Add Action (Under Immediate actions), Select the type of action to create (In our case Flows), and then fill out the fields to define the action, as shown in the following screenshot
5. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally, the Process will look like the following screenshot
Don’t forget to active the Process by clicking on the Activate button.