Staying on top of assigned work is important when it comes to overall project completion and ensuring that everything stays on track. While every user has their own approach to track assigned to-do's, notifications can be helpful as well. This article will walk through the steps to set up a custom notification to alert task owners if any of their assigned tasks became overdue.
In summary, the configuration will include the following steps:
In this article, the automation is set up to notify task owners after their tasks become overdue. However, keep in mind that it is possible to adjust the automation to trigger when tasks that are nearing their due date or to send such notifications several days after tasks are created. These types of adjustments could be useful for different use cases.
Step 1: Create the Email Template [Admin]
The first step of the process is to create an email template. For this purpose, you will need to create a Lightning Email Template.
- From anywhere in Salesforce, navigate to the App Launcher (icon located to the left of the navigation bar in Salesforce).
- Within the App Launcher, search for and navigate to Email Templates.
- Click on the New Email Template button.
- In the New Email Template modal, enter Email Template Name (e.g. "Overdue Task") and Description.
- For Related Entity Type, select TaskRay Task (this will allow referencing fields from the TaskRay Task object in the email).
- For Folder, select a public folder to store the new email template.
- Under Message Content, enter a Subject (e.g. "Your Task Is Overdue").
- In the HTML Value text box, enter the text for the body of the email. Sample text below:
Hi {{{TASKRAY__Project_Task__c.OwnerFirstName}}},
The task {{{TASKRAY__Project_Task__c.Name}}} is now overdue (task due date is {{{TASKRAY__Project_Task__c.TASKRAY__Deadline__c}}}). Click on the task name to review its details and make the necessary updates.
Tip: In the sample text provided, to turn the task name into a hyperlink that takes users to the tasks in TaskRay, it is necessary to configure a dynamic URL. This is a sample URL that can be used, as long as you modify the domain (in place of YOUR-DOMAIN-HERE) to match your org's domain: https://YOUR-DOMAIN-HERE.lightning.force.com/apex/TASKRAY__trtaskboard?projectid={{{TASKRAY__Project_Task__c.TASKRAY__ProjectId__c}}}&taskid={{{TASKRAY__Project_Task__c.Id}}} - Click Save.
Step 2: Create Email Alert [Admin]
Now that you have a notification template, the next step is to create an Email Alert. The email alert is necessary for the Flow, as well as to specify who the alert should be sent to. In this case, it will be the TaskRay Task Owner of the task that became overdue.
- From Setup, navigate to Process Automation | Workflow Actions | Email Alerts.
- Click on New Email Alert.
- Enter a Description (e.g. "Notify Task Owner When Task Becomes Overdue"). The Unique Name field should populate automatically.
- For Object, select TaskRay Task.
- For Email Template, click on the lookup icon and select the Overdue Task template that you created previously (from the section above).
- Select Recipient Type. For Search, select Owner. This will filter the list of Available Recipients below. From the list, select TaskRay Task Owner and move it to the Selected Recipients section using the Add button.
- Click Save.
Step 3: Set Up the Flow to Send the Notification Email [Admin]
Next, you will need to build the process that would send the notification email to the task owner when their task becomes overdue.
Flow Overview
When you are done setting up the flow, it will look something like this:
Follow the steps in the sections below to configure the Flow.
Step 1: Create New Flow
- From Setup, navigate to Process Automation | Flows.
- Click on the New Flow button.
- In the New Flow modal, select the Schedule-Triggered Flow option.
- Click on Create.
Step 2: Configure Start and Entry Conditions
When setting up a new schedule-triggered flow, it is necessary to specify the object and criteria that will trigger the automated process. In this case, we will select the TaskRay Task object.
- On the Flow Canvas, in the Start element, click on the + Set Schedule option.
- Within the Set a Schedule modal, configure when and how often the Flow should run. For the purpose of this article, we will set it to run daily at 8 AM. For this configuration, set the following:
- Start Date = set to the date when the process should start running (e.g. next day)
- Start Time = 8:00 AM
- Frequency = Daily
- Click Done
- Back on the canvas, in the Start element, click on the + Choose Object option.
- Within the Choose Object and Filter Conditions modal, click into the Object field and search for TaskRay Task.
- In the Set Entry Conditions section, for Condition Requirements select All Conditions Are Met (AND).
- For the condition, set the following:
- Field = TASKRAY__trCompleted__c (Completed)
- Operator = Equals
- Value = {!$GlobalConstant.False}
- Add another condition by clicking on the + Add Condition button and set the following:
- Field = TASKRAY__Archived__c (Archived)
- Operator = Equals
- Value = {!$GlobalConstant.False}
- Click Done.
Step 3: Add a Decision Element To Check For Additional Criteria
Next, you will need to add a Decision Element that checks for some additional criteria on the tasks. More specifically, the Decision Element will check if the task is part of a template (to ensure that template tasks are excluded from the automation) and if the task's Estimated End Date has passed. The Decision Element will only have one outcome for the purpose of this automation.
- On the Flow canvas, click on the Plus / Add Element icon below the Start element.
- Select the Decision element.
- In the New Decision modal, enter the Label (e.g. "Task Overdue/Template?") and API Name.
- In the New Outcome section, fill out the Outcome Details (enter the Label (e.g. "Send Notification") and Outcome API Name).
- Next, for Condition Requirements to Execute Outcome, select All Conditions Are Met (AND).
- For the first condition, set the following:
- Resource = {!$Record.TASKRAY__Deadline__c} (clickpath: $Record > Estimated End Date)
- Operator = Less Than
- Value = Current Date (clickpath: $Flow > CurrentDate)
- Click on + Add Condition and set the following:
- Resource = {!$Record.TASKRAY__Project__r.TASKRAY__trTemplate__c} (clickpath: $Record > TASKRAY__Project__r > TASKRAY__trTemplate__c)
- Operator = Equals
- Value = {!$GlobalConstant.False}
- Click on + Add Condition and set the following:
- Resource = {!$Record.TASKRAY__Deadline__c} (clickpath: $Record > TASKRAY__Deadline__c)
- Operator = Is Null
- Value = {!$GlobalConstant.False}
- Click Done.
Step 4: Configure Decision Outcome Actions
For the final portion of the Flow, you will need to set up the actions that should take place, such as sending the emails to the overdue task owners. In this case, you will need to define what happens for both of the outcomes that are related to the Decision Element.
Configure the Default Outcome
First, we will configure the Default Outcome to not have an action.
- On the Flow canvas, click on the Plus / Add Element icon below the Default Outcome path for the Decision element.
- Select the End option.
Configure the Send Notification Outcome
Next, we will configure the Send Notification Outcome to send emails to the overdue task owners.
- On the Flow canvas, click on the Plus / Add Element icon below the Send Notification Outcome path for the Decision element.
- Select the Action option.
- In the New Action modal, in the Action field, search for the email alert that you created previously (e.g. "Notify Task Owner When Task Becomes Overdue").
- Enter a Label and API Name.
- Under Set Input Values, for Record ID, select {!$Record.Id} (clickpath: $Record > Id).
- Click Done.
Step 5: Save and Activate the Flow
Now that the Flow is fully configured, it is time to save and activate it.
- In the top right corner of the Flow canvas, click on the Save button.
- In the Save the Flow modal, enter the Label (e.g. "Send Email To Task Owner When Task Is Overdue") and API Name.
- Click Save.
- In the top right corner of the Flow canvas, click on the Activate button.
Test the Flow
As a best practice, it is always a good idea to test custom automations to make sure that they meet requirements and follow expected behavior. Custom automations can be tested using the Debug options in Flow, using sample test records.