I have been able to successfully loop through the XML in the repeating section; what I need to do now is to run a site workflow every day that loops through each list item to check's Today's Date against the Activity Due Dates and send emails accordingly.
My one and only problem here is trying to get the workflow to loop through each list item. At the moment it only picks up the first item in the list. Help! Am I looking at nesting the existing repeating section loop inside a List Item loop? Some workflow samples would be appreciated.
Solved! Go to Solution.
So having now put an outer loop the site workflow appears to be looping through each list item, but keeps getting the same repeating section from the first list item?
The outer loop itself is used in the form workflow and works perfectly so I don't see why any action should be changed in the inner loop.
Outer for each:
Inner for each:
but keeps getting the same repeating section from the first list item?
how do you populate ResponsibleBUCollection? in a query before loops?
with every iteration of outer loop you start over loop for ResponsibleBUCollection collection. since the ResponsibleBUCollection seems to be populated before loops you still work with the same content.
1. start an outer loop (to iterate through items)
2. within the loop, convert repeating section of current item (identified by outer loop index) into (set of) collection(s).
3. start an inner loop over (one of) collection populated in step 2.
These are the actions used prior to the outer loop:
1. The Query list action retrieves the following fields. Note that the WorkActivities field is basically a multiple lines of text field type used to to hold the repeating XML for ResponsibleBU, ActivityDueDate, WorkActivity, and Completion Date. These are the fields needed for the inner loop.
2. I then query WorkActivities to extract the 4 repeating fields and store them in separate collections.
I did what you suggested, but still can't get it to get the repeating data in the next list item. I'm thinking that the logic may not be correct in the inner loop's for each, but what collection should then I be targetting for the repeating section, if ResponsibleBU isn't correct? Repeating sections don't have ID's themselves.
This same inner loop is used in the Form Workflow - without the outer loop of course (note this is a site workflow) and already works perfectly as it is.
so does revised workflow work or not?
btw, do not increment loop index variable on your own, for each loop action takes care of its incrementing...
I finally figured it out!
The data that wasn't part of the repeating section - I had failed to put them in collections. So in essence I was always dealing with the data in the first list item even though the outer loop was moving on to the next list item.
I believe I need to increment both outer and inner loop indexes because the collection operations require an index.
I will post a screenshot of the working workflow when I'm back next week.
This site workflow works 100% and will run once a day to check all list items and their associated activity due dates captured as repeating section data.
If any work activity due dates are found to be meet the specified criteria, it'll send out email reminders.