AnsweredAssumed Answered

For Each Loop Loops Too Many Times

Question asked by andreapasutti on Dec 11, 2017
Latest reply on Dec 12, 2017 by jesse.mchargue

I have a list of all the sites in our site collection. For each site, the members and owners are populated. I add each member and owner to their own collection variables, then I loop through the collection variable to get their display name and add them to a list via build string. This list will go in the body of the notification so the recipient can know who all the owners and members of their site are without having to navigate there.

 

Once all the owners and members have been added to the collection, we evaluate and remove based on certain criteria (not a valid employee in AD, a VIP, etc.). In my latest test, I have removed 3 owners and 2 members. The problem is that the loop will continue 3 more times and add the last person's name to the list each time. It appears to be adding extra semicolons at the end. This does not coincide with any owners or members I have removed from the list (removed 2 members, added 3 semicolons). I have a commit pending changes after each build string in the loop. What is going on? I've used For Each loops to do this very logic in other workflows and this hasn't happened.

Outcomes