cancel
Showing results for 
Search instead for 
Did you mean: 

Send grouped notification based on list items

Automation Master
Automation Master
5 23 9,818

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  and I've moved the Set variable action outside the Run If (in the second screenshot of the workflow)

23 Comments
Nintex Newbie

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

Automation Master
Automation Master

Hi J Hong‌,

I've just published the workflow in Xchange:  

Nintex Newbie

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,

Automation Master
Automation Master

Hi cvuppala‌,

if I've understood correctly, you have a task list with two approvers (A and B) 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?

Nintex Newbie

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.

Nintex Newbie

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?

Nintex Newbie

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.

Automation Master
Automation Master

Hi,

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)

Nintex Newbie

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.

Automation Master
Automation Master

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?

Nintex Newbie

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: https://www.habaneroconsulting.com/insights/creating-attractive-emails-with-html-tables-in-nintex#.W... 

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!

Automation Master
Automation Master

Hi,

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).

Nintex Newbie

Hi ‌,

Thank you for the reply,

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

workflowhtml tableoutput email

Automation Master
Automation Master

Hi,

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..

Nintex Newbie

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>
</tr>

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

{WorkflowVariable:ItemLink}
{Common:WebUrl}/Lists/{Common:ListName}/DispForm.aspx?ID={WorkflowVariable:IDs}

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

{WorkflowVariable:Email}</table>

Automation Master
Automation Master

Hi,

while you build the content of the table, there is an error in last td..you 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..

Nintex Newbie

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

Automation Master
Automation Master

Hi,

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..

Nintex Newbie

‌,

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.

Automation Master
Automation Master

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?

Nintex Newbie

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

Nintex Newbie

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?

 

Thanks,

Jonathan

Nintex Newbie

Dears,

where I can found the nwf?

 

Thanks in advance.