jackgelo

Send grouped notification based on list items

Blog Post created by jackgelo Champion on Apr 27, 2017

Hi,

 

Often here on the forum someone asks how to send a notification based on a list/library grouping items instead of sending one email for each item, e.g. in a task list I want a single notification for each assignee with the list of all the tasks that are assigned to that specific people..

 

This is my solution, hope it can help someone!

 

First action will be a Query List Action where I can set all the optional filter, if I don't want to get all items in my source and, most important, I sort items by the field I want to group by.

Then I save all the fields I want to include in my notification in collection variable, also the field I want to group by should be stored in a collection variable.

Query List Settings

Then I start looping on the groupBy collection variable and then I get all the related information from the other collection using the same index:

Collection Operation

If the index is not equal to 0 and the previous value of my grouping condition is not equal to the current one, I'll send a notification with the previous built text and then I clear it and change the variable pPrevAssignee with the new grouping condition

Run If Conditions

Outside the Run If I'll update the variable with the text I want in my email

Build String

Last step, outside of the For Each, I have to send a notification to last assignee (I've that value inside my variable pPrevAssignee) otherwise last grouped items will not be notified.

 

And that's how my workflow looks like:

Workflow Design - Part 1Workflow Design - Part 2

Edit 28/04/2017: I've added the workflow on Xchange Send Grouped Notification Site Workflow and I've moved the Set variable action outside the Run If (in the second screenshot of the workflow)

Outcomes