Send grouped notification based on list items

Badge +11



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 1 Workflow Design - Part 2

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

26 replies

Badge +2

Hi  Giacomo Gelosi

thanks for writing the article.  this sounds like what I want to do, but as I'm a beginner, I followed the steps up until the collection, then I got lost.  Would you be able to attach the nwf sample....perhaps I can work through the example file.  Thanks

Badge +11

Hi J Hong‌,

I've just published the workflow in Xchange:  

Badge +8

Hi Giacomo,

I followed your example and here is what I noticed. there are two distinct assignees in my list. First one has two list items assigned and the second one  got assigned 15 items. With the logic you have in place, the second assignee receives a notification where his first assignment is shown twice. I am not sure why this is happening. Any ideas?

Please advise,

Badge +11

Hi cvuppala‌,

if I've understood correctly, you have a task list with two approvers (A and 😎 and tasks like the following (Assignee-ID): A1, A2, B3, B4, B5..

If you run the workflow, to approver A goes a notification with tasks A1 and A2 while approver B receives B3, B3, B4 and B5, is it right? if yes, this shouldn't happen..

are you trying to use one of my workflow on Xchange or have you built one from scratch following my post? If you have built the workflow and try to compare it with mine, are there any differences?

Badge +8

Hi Giacomo,

i am exactly seeing what you have outlined.  I have imported your workflow and made necessary changes and I still see this problem. I will compare your workflow one more time. 

also, how do i build a table of items assigned to the user in the mail?

Thank you.

Badge +8

Hi Giacomo,

I comapared the workflows and I think I had a mistake in my logic. I fixed it and it worked fine. How do I create a table of all the items where each row represents the assigned task?

Badge +8

Below is how I modified the workflow to build a table of items assigned to each assignee. Under Query list action, I used a build string action that has the following HTML for the start of the table.

I close the table out side the for loop with another Build string action with following HTML.

However, this logic only builds the table for the first returned assignee. so if we have two distinct users, A, B then it only builds table for items returned for A.

Please advise.

Badge +11


in order to achieve the correct html markup, you should close and reopen the table each time the assignee change (before and after the send notification inside the loop)

Badge +4

Hi Giacomo Gelosi,

I have a list with fields: order number, description, supplier name, supplier number, and sales person. I want to send one email to salesman for orders related to them (more than one item). I am confused with the pPrevAssignee and cannot find where you have setup the variable or used it. A more detailed .nwf would help.

Badge +11

Hi Bhashwar Bhattarai‌,

at the end of my post, under all the screenshot, there is a link of an element on Xchange where I've already put the nwf (and also the version for O365).. have you had a look on it?

Badge +4

Thank you Giacomo Gelosi for the reply.

I was successful in sending grouped email but the real challenge for me was to do something like this: 

and add a column called link to item, and only email the items related to the user with the link to the item in link to item column. I was even successful in creating the link to the item and sending to grouped user in one email, but struggling to put individual links in separate rows related to that item.

I greatly appreciate your help!

Badge +11


if have you been able to get all the information you need for each single row, e.g. title and link to the item, you've done the most..

Like in your link, you have to build the header and footer of your email (have a lookup on comment from cvuppala above and my response) and in the build string inside the for each action where you actually write your content, you have to write the html text for the whole row (so you have to put the <tr> and <td> tag corresponding to your columns, and the content in it).

Badge +4

Hi ‌,

Thank you for the reply,

I am already using all of that, please see screen shots below:

workflowhtml tableoutput email

Badge +11


could you post a screenshot of the build string where you create the header of your table and the one where you build a row of the table? I think that there is a missing <td> somewhere..

Badge +4

Hi Giacomo Gelosi‌,

I am using Real-time HTML Editor, and below is the string:

The bold ones are set as variable: {WorkflowVariable:Email}

<table cellpadding="2" style='border-collapse: collapse; border:1px solid ffffff; font-family:"Helvetica","sans-serif";'><tr><td colspan="10" bgcolor="#f2fcfc" align="center" style='font-size:20.0pt;font-family:"Helvetica","sans-serif";color:#000000; font-weight:bold'>PO Information Report</td></tr><tr><td></td></tr><tr><td colspan="10" align="center" bgcolor="#f2fcfc" style='font-family:"Helvetica","sans-serif";color:#000000'>Below is the PO information</td></tr><tr align="center" bgcolor="#808080" style='font-weight:bold; font-family:"Helvetica","sans-serif";color:#ffffff'><td style='border: 1px solid #f2fcfc;'>PO#</td><td style='border: 1px solid #f2fcfc;'>Job#</td><td style='border: 1px solid #f2fcfc;'>Vendor#</td><td style='border: 1px solid ffffff;'>Vendor Name</td><td style='border: 1px solid #f2fcfc;'>Description</td><td style='border: 1px solid #f2fcfc;'>Ordered Date</td><td style='border: 1px solid #f2fcfc;'>Ordered By</td><td style='border: 1px solid #f2fcfc;'>PO Amount</td><td style='border: 1px solid #f2fcfc;'>Time Keeper</td><td style='border: 1px solid #f2fcfc;'>Link To Item</td>

Below is all together: 

{WorkflowVariable:Email}<tr align="center"><td bgcolor="#ffffff" style='color:#000000; font-weight:bold; border: 1px solid #ffffff;'>{WorkflowVariable:txtPONumber}</td><td style='border: 1px solid #ffffff;'>{WorkflowVariable:txtJobNumber}</td><td style='border: 1px solid #ffffff;'>{WorkflowVariable:txtVendorNumber}</td><td style='border: 1px solid #ffffff;'>{WorkflowVariable:txtVendorName}</td><td style='border: 1px solid #ffffff;'>{WorkflowVariable:txtDescription}</td><td style='border: 1px solid #ffffff;'>{WorkflowVariable:txtOrderDate}</td><td style='border: 1px solid #ffffff;'>{WorkflowVariable:txtOrderedBy}</td><td style='border: 1px solid #ffffff;'>{WorkflowVariable:txtPOAmount}</td><td bgcolor="#ffffff" style='color:#000000'>{WorkflowVariable:txtTimekeeper}</td><td bgcolor="#ffffff" style='color:#000000'>{WorkflowVariable:ItemLink}</td></tr><tr align="center"><td style='border: 1px solid #ffffff;'>&nbsp</td><td style='border: 1px solid #ffffff;'></td><td style='border: 1px solid #ffffff;'></td><td style='border: 1px solid #ffffff;'></td><td style='border: 1px solid #ffffff;'></td><td style='border: 1px solid #ffffff;'></td><td style='border: 1px solid #ffffff;'></td><td style='border: 1px solid #ffffff;'></td><td style='border: 1px solid #ffffff;'></td style='border: 1px solid #ffffff;'></tr>

Below is the item link string set as variable: itemLink


I have used the closing string as variable = CloseEmail, but not put in email (i actually don't know where this will go)


Badge +11


while you build the content of the table, there is an error in last have written </td style='border:1px solid #ffffff;'></tr> while it should be </td><td style='border:1px solid #ffffff;'></td></tr>

Maybe that's the issue that makes your table not properly formatted..

Badge +4

Hi ‌,

That did not make any difference. I am still getting all the items links related to me inside the column but only one item is showing.

after correction

Badge +11


right now, we've fixed the layout of the table (before it doesn't show last column..I've thought that was the issue)..

all the links are related to the same item (and you want to duplicate information for each link) or are related to different items? I ask that because in second case you're currently building the list of all those links in variable ItemLink..maybe is enough to put {Common:WebUrl}/Lists/{Common:ListName}/DispForm.aspx?ID={WorkflowVariable:IDs} as content of last column instead of ItemLink..

Badge +4


Thank you!

No all the links are different items but related to time keeper. The links are showing up but other items related to link/ time keeper are not.

Badge +11

Hi..I think that this is becoming a bit complex to be solved only here on the community, without knowing list structures and/or settings for query in workflow... do you work with some Nintex Partner that can help you having a look on your workflow in order to understood and find what's missing to reach the goal?

Badge +4

Thank you ‌. I will get with partner on this.

Badge +4

Hi Giacomo,


This blog post looks very promising and related to what I am trying to accomplish, but I do not see any .nwf file attached or any links to such a file.  Could you please tell me how to access that or could you potentially upload that again?




Badge +1


where I can found the nwf?


Thanks in advance.

Can some let me know where i can find s nwf, i would like to follow this solution but can not find it.

Hi @jackgelo,

This is exactly what I am trying to do but I have Nintex for Office 365 which does not have the Collection Operation action. Do you know how to GroupBy using a different tool?