Add All Expired Tasks in Single Email to Notify Task Owners Using Salesforce Flow : Shubham
by: Shubham
blow post content copied from SalesForce FAQs
click here to view original post
### Summary In this content, the author discusses a solution for managing expired tasks in a project management application using Salesforce Flow. The main challenge is that employees often juggle multiple tasks, leading to missed deadlines. Instead of sending individual emails for each expired task, the author proposes a method to compile all expired tasks into a single email for each task owner. The tutorial outlines the steps to create a scheduled flow in Salesforce that checks for expired tasks daily. It involves setting up a flow that retrieves tasks with due dates that have passed, groups them by task owner, and sends a single email containing all expired tasks. The email includes a table with task details and clickable links to the tasks. ### Key Steps in the Process: 1. **Create a Scheduled Trigger Flow**: Set the flow to run daily. 2. **Retrieve Expired Tasks**: Use the "Get Records" element to find tasks that are not completed and have a due date earlier than the current date. 3. **Loop Through Tasks**: Iterate over the retrieved tasks and group them by task owner. 4. **Send Email**: Construct an HTML email that lists all expired tasks for each owner, including task details and links to view them. ### Additional Context This approach not only streamlines communication but also helps task owners manage their responsibilities more effectively. By consolidating notifications, it reduces email clutter and ensures that task owners are promptly informed of their overdue tasks. ### Hashtags for SEO #SalesforceFlow #ProjectManagement #TaskManagement #EmailAutomation #SalesforceTutorial #ExpiredTasks #WorkflowAutomation #SalesforceTips #ProductivityTools #EmailNotifications
While working on a project management application, I realized that keeping track of tasks can be challenging. When employees work on multiple tasks, they may not be able to complete some tasks on time.
Now, instead of sending an email for each expired task separately, we can add all expired tasks to a single email and send it to the respective task owner.
So that whenever an employee opens the email, they can see all expired tasks, and as they click on ‘View Task’, they will be redirected to the task record.
In this tutorial, we will learn about how to add all expired tasks in single email to notify task owners using Salesforce Flow.
In this, I will explain which flow we need to use and also show you when the task owner receives the email, how they can redirect to the task by clicking on the link.
Add All Expired Tasks in Single Email to Notify Task Owners Using Salesforce Flow
Below, I will explain how to create a flow that adds all expired tasks to a single email to notify task owners using Salesforce Flow.
We need to check every day whether there are any tasks whose due date has passed. For this, we have a schedule trigger flow that runs daily at the time we defined.
Log in to Salesforce Org. -> Click on the Setup -> Home Tab -> In Quick Find Box, Search for Flows. You will see an option under Process Automation -> Click on Flows.
Then, click on the New Flow button to create a new flow.
Here, we will schedule the flow to the freeze user. For that, create a flow with a Scheduled Triggered Flow.
As we click on schedule trigger flow, we need to set a schedule time:
- Start Date: When do you want to start the flow?
- Start Time: When should it trigger in the day?
- Frequency: Here, we can select Once, Daily, and Weekly.

Next, we need to retrieve all the tasks whose due date has passed, stored in the Task object. For that, we need to add the Get Records element and enter a Label and API Name.
Then enter the Filter Conditions so that only those records will get entered in the flow that meet the condition requirement:
- Status– Does Not Equal – Completed.
- Due Date – Less Than – Current Date.
- Activiti ID (Task ID) – Equals – RecordId.
Store All Records to make this a Collection variable.

Now, we will use the loop element to iterate over the records that we retrieved in the get record element. To add the Loop Element, click on the Add Element icon.
Then, enter the element Label and API Name.
Then, select the Collection Variable, which is Get Records(API Name), and select the iteration direction from the first item to the last item.

We will group the tasks by task owners so that all expired tasks related to that owner will get sent at once.
To ensure we store unique users, we need to create a new variable. To do that, click New Resource and select the Resource Type as Variable. Enter API Name. Here, I have entered TempUserId.
Select ‘Data Type’ as ‘Text‘ and allow multiple values, and select ‘Task‘ as the object. Click on Done.
After that, add the Assignment element to add task owner ID to the created variable.

After that, using the Decision element, we will check whether the variable does not contain duplicate IDs.

If it does not contain, then we will add user IDs from TempUserID to the UniqueUserIDs. That means in the UniqueUserIDs variable, we will have all task owner IDs whose task has expired.

Again, we will add a Loop element to iterate over user IDs so that we can send email to each task owner.
To access the user details, we need to retrieve the user records stored in the User object. For that, we need to add the Get Records element and enter a Label and API Name.
We only want those users whose user ID is available in the above loop element record collection. For that, enter the Filter Conditions:
- User ID (User) – Equals – RecordId.
- Status– Is Null – False.
Now, we can use the user details in Email Template dynamically.

Now, instead of sending an email for each expired task separately, we will add all expired tasks to a single email and send it to the respective task owner. For that, we will add task subject, due date, status, and link.
We will send this in an HTML table. To do so, create the EmailBody as a text variable. Then, add an assignment element and create the table header, providing the HTML code in a variable.
HTML – Table Column:
- EmailBody – Equals – (Below HTML Script)
<table border='1' cellpadding='5' cellspacing='0'>
<tr>
<th>Subject</th>
<th>Due Date</th>
<th>Status</th>
<th>Link</th>
</tr>

Now we need to add expired tasks one by one in the table. To iterate over the task records, again add the loop element inside the outer loop element.
Add the get record element API name (collection) that we added above the Assignment element.
Now, to add the task record values to the table as a row, again, we need to add HTML script to the EmailBody.
- EmailBody – Equals – (Below HTML Script)
{!EmailBody}
<tr>
<td> {!Loop_Through_User_s_Tasks.Subject} </td>
<td>{!Loop_Through_User_s_Tasks.ActivityDate}</td>
<td>{!Loop_Through_User_s_Tasks.Status} </td>
<td><a href='https://ashoresystempvtltdpune-dev-ed.lightning.force.com/{!Loop_Through_User_s_Tasks.Id}'>View Task</a> </td>
</tr>
After that, we need to close the table tag outside the loop element.
{!EmailBody}
</table>

Now, to send the email, we need to add the Send Email action element. Here you need to select the field values to send an email, such as sender email, subject, body, recipient address, etc.
In the body, we inform the task owner that some tasks have expired. In the Body, you need to provide the EmailBody variable, in which we updated the HTML table.
Since we used an HTML email template, we need to select ‘View as Rich Text’ in the body, and also choose ‘Rich-Text-Formatted Body‘ as ‘True‘.

Now we are ready to save the flow. For that, click the Save button, provide the flow Label, and the API Name will be automatically populated.
After that, always debug the flow before activating it to ensure that the working flow is correct and that there are no runtime errors. Then activate the flow.



As you activate the flow, it will then check the due date every day. If the due date has passed and the task is not completed, the flow will trigger, and at the specified time, it will send an email to the assigned task user.
You can see the recovered email in which the task whose due date has passed. Only tasks added with their subject, due date, status, and clickable link are shown.

I hope you have got an idea about how to add all expired tasks in a single email to notify task owners using Salesforce Flow. In this, I have explained which flow we need to use and also shown you how the task owner receives the email and can redirect to the task by clicking on the link.
You may like to read:
- Send Email with Flows in Salesforce
- Send An Email with Dynamic Attachments in Salesforce Flow
- Set Up Email-To-Case in Salesforce
The post Add All Expired Tasks in Single Email to Notify Task Owners Using Salesforce Flow appeared first on SalesForce FAQs.
July 23, 2025 at 05:10PM
Click here for more details...
=============================
The original post is available in SalesForce FAQs by Shubham
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Post a Comment