I have a document library that has a field called Manager. There are over 30 managers. I want to send 30 emails to each of the 30 managers along with all there associated rows. I set up a WF that uses a Run Query first that retrieves the entire library for today's work.
Within the Query I have a Managers Collection,Log Description Collection and a Call Center Collection.
I know I can set-up 30 Workflows and query for each manager, but there has to be a more efficient route. Essentially I want to retrieve all data found for Manager 1 and send email, the next iteration would look for all data associated with Manager 2 and send email, etc...Perhaps I need to use a Loop in combination with a For Each
Solved! Go to Solution.
Yes. Essentially I created 2 For Each Loops. First I did a Collection Operation (post Query List) to Group on the ItemID. I then did a For Each on the ItemID (too me this is essentially the Outer Loop). I then did another For Each on the ItemID (but NOT grouped; too me this was the inner loop) and grabbed all the detail rows if the Grouped ItemID equalled the Non-Grouped ItemID. Once the inner loop was exhausted it iterated to the next Grouped ItemID (outer loop) and then entered the inner loop for the detail, etc.
I did a Build string within the Inner loop. Once the inner loop was exhausted and before entering the next Grouped ItemID found in the Outer loop I send the email.