cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Help Me Loop Through Each List Item That Has A Repeating Section

Jump to solution

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.

Labels: (1)
Reply
8 Replies
Workflow Hero

Re: Help Me Loop Through Each List Item That Has A Repeating Section

Jump to solution

have a look on this thread, there I guided to resolve the same problem

 

Reply
Workflow Hero

Re: Help Me Loop Through Each List Item That Has A Repeating Section

Jump 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:

0 Kudos
Reply
Workflow Hero

Re: Help Me Loop Through Each List Item That Has A Repeating Section

Jump to solution

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.

you should:

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.

0 Kudos
Reply
Workflow Hero

Re: Help Me Loop Through Each List Item That Has A Repeating Section

Jump to solution

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.

REVISED WORKFLOW:

0 Kudos
Reply
Workflow Hero

Re: Help Me Loop Through Each List Item That Has A Repeating Section

Jump to solution

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

0 Kudos
Reply
Workflow Hero

Re: Help Me Loop Through Each List Item That Has A Repeating Section

Jump to solution

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.

Reply
Workflow Hero

Re: Help Me Loop Through Each List Item That Has A Repeating Section

Jump to solution

Log in history list showing the 2 list items and their corresponding outer and inner loops:

0 Kudos
Reply
Workflow Hero

Re: Help Me Loop Through Each List Item That Has A Repeating Section

Jump to solution

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.

0 Kudos
Reply