Sending one email to approvers for multiple list items

Posted by

Imagine you’re part of a project management team working on multiple projects simultaneously. Your team uses a SharePoint list to track project tasks and assignments. Each task has an assigned team member responsible for its completion, and there’s a field called “Needs Review” to indicate if a task requires review. However, the catch is that they should receive just one email.

Source Data

Power Automate Logic

  1. Create a new flow: Go to the Power Automate dashboard and click on + Create to create a new flow. Choose Scheduled cloud flow for a monthly email notification.

2. Set up the schedule: Set up the schedule to run monthly.

3. Get items from SharePoint or Excel: Add a new step by clicking on + New step, then choose the Get items or List rows present in a table excel action. Provide the necessary details like the site address and list name.

4. Filter the items: In the Filter Query field of the Get items action, you can add a condition to filter the items that need review. For example, if ‘Needs Review’ is a Yes/No field in your SharePoint list, you could use Needs_x0020_Review eq 1 to filter for items that need review (replace Needs_x0020_Review with the internal name of your field).

5. Find the unique emails: Since we want to notify the approvers with just one email, we need to first get the unique recipients. This can be done using the two actions below.

Expression: union(body('Select'),body('Select'))

6. Loop recursively

  • For each user, filter the records that match that user’s assignments.
  • Create an HTML table containing the filtered records.

7. Formatting Email: Lets make the Email look pretty by adding some styles

<style>
table {
  border: 1px solid #1C6EA4;
  background-color: #EEEEEE;
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}
table td, table th {
  border: 1px solid #AAAAAA;
  padding: 3px 2px;
}
table tbody td {
  font-size: 13px;
}
table thead {
  background: #1C6EA4;
  border-bottom: 2px solid #444444;
}
table thead th {
  font-size: 15px;
  font-weight: bold;
  color: #FFFFFF;
  border-left: 2px solid #D0E4F5;
}
table thead th:first-child {
  border-left: none;
}
</style>

8. Notify the approver

Conclusion

Here is the attached flow.

Sendingoneemailtoapproversformultiplelistitems_20240513011319.zip

Leave a Reply

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