Trigger approval notifications nightly as a summary email


Badge +9

Hi, Currently I have a Workflow set up to notify a manager every time a employee inputs a calendar item.  Thus, if 5 people make calendar entries during the day she receives 5 emails.  The goal is now to receive one email nightly that provides a link to each list item that was modified during the day (needs approval).  Can anyone push me in the right direction on how to achieve this task. 

Jesse McHargue   https://community.nintex.com/message/40708?et=watches.email.thread#comment-40708 was helpful in getting me started in my first Nintex workflow so I do have some minimal experience in query lists and collections.  I am hoping I can now further expand on this knowledge with this current request.

I use Nintex with SharePoint 2013 Enterprise.

Thanks !


12 replies

Userlevel 6
Badge +13

So the principle behind this solution will be to create a Site Workflow.

The site workflow will run every evening at a specified time on a schedule you configure.

The workflow would query your list, to find all the items that match your criteria, this could simply be "modified date" == today's date or anything more complicated.

Store the ID's of all the results into a Collection.

You could then loop through the collection, query the same list using the ID to find the Item's URL (or alternatively just build the URL using "http://sitename/list/viewform.aspx?ID={your variable containing the itemID}").

Using another Build String action in the loop, you can start building the HTML that will make up your email and append the Item URL in the variable containing your HTML each time it goes through the loop.

So by the time you've got to the end of your loop, you've got your opening HTML, all your list items URL's embedded in the HTML as links and then once you've exited your loop, append the remaining HTML to the end of your variable and in your Send Notification add your variable containing all you HTML into the body of your email.

Badge +9

Thanks..I look forward to giving this a try on Thursday and letting you know how it went...thx Ryan..

Badge +9

Hi, so I think I got it running, but 2 questions.

1-If there are not modifed items for today how do I stop the WF

2-I am send out an individual email for each Team.  Do I need to create 4 queries to filter for each of the teams or there a more efficient way to send 4 individual emails to the 4 teams once the collection has collected all my data for today.

Userlevel 6
Badge +13

1. After you've done your query and stored the results in a collection, use the Collection Operation action to do a "Count" of items in the collection and store the result in a variable. Use a Run If action to evaluate whether the variable = 0 and within the Run If, put an End Workflow action.

2. Are you sending out the same email to 4 teams or a different email. If it's the same email that's simple, you place as many teams as you want in the recipients field. I'm presuming it's different content though, so you can either just wrap your first set of actions that build your email into an Action Set, copy and paste it and edit it as required in a linear fashion, or put them in a Parallel action so they all run at the same time. Again, just put all the actions that you use to build the workflow into an action set and then copy them and edit them as required.

A quick thought, that first point, if you are performing a different query for each team, to evaluate whether the workflow should run through in point 1, you'll want to just do a query of all the items, no other filters other than whether an item changed that day, otherwise you'll be cancelling the workflow based on one query, and not the other 3 queries.

Badge +9

Hi Ryan,

I would have different content for each team.  I am checking the same calendar that multiple teams use...I am thus trying to check if any of the 4 teams had calendar events for today.  If 3 of the 4 teams had calendar events created today that I wish to send 3 separate emails. Each of the emails would have the events created for today for there respective team.

Userlevel 6
Badge +13

Yeah, so in that case, put your actions for querying and building the HTML into an action set, copy it paste it (potentially in a different branch of a Parallel action) and just modify your query as required in each branch.

To end the workflow if there are no changes to notify on, you'd be best off doing the "Count" and "Run If" mentioned but little differently.

Instead of doing the "Count" to see if the collection is zero, get your "Run If" to evaluate if it's greater than zero in the collection, then put your For Each and all the other actions, inside the Run If, that way it only runs and sends the notification if the collection has 1 or more items in it.

Just remember, if you do run the different action sets in parallel, you need to create new collections and variables and name them differently in each branch, so they don't overwrite each other as they will obviously be returning different results at the same time.

Hope this is helpful to you and if so, please mark it as correct for other users to reference.

Thanks

Badge +9

Thanks Ryan...can you expand on the Count and Run If.  It sounds like you are saying NOT to use a Count, but only use a Run If..How would I apply the Run If if I am not creating a Count ?  thx

Badge +9

Hi David...I think I figured out the Count/Run If...Thus, let me try to finish up and I will let you know how I get along...

Badge +9

Hi Ryan,  It appears to work (I will run a few more tests).  One final question.  Why did I need to create separate variables when rumming in parallel.  If they run parallel, are they not also running distinct from the other branches so why can't I use the same variable in each parallel branch.

Userlevel 6
Badge +13

A variable is like a box, and you're putting a value into that box. It can only accept one value though, so if you put the value from branch 1 into the box, and then a millisecond later, you put the value from branch 2 in that box, the value from branch 1 will disappear. Hence you need to have a variable for each branch to avoid overwriting values from the other branches.

Once you've got this working, can you mark the post that resolved this for you as answered so other users can find this in future.


Thanks

Badge +9

Hi...Its working great now.  Thx for your patience.  For the variables the box analogy is great so my assumption is that with branches each branch is running in parallel, one branch is not waiting for the other branch to finish ?

Userlevel 6
Badge +13

Correct.

Reply