Skip to main content

Hi All, 

 

I'm trying to get a workflow together that will query a large list of items, divide them evenly among a number of people that may vary (there is another list that sets a persons status as to whether they will receive anything that day) and "assign" the items to them.

 

I have a list workflow that assigns one item, then starts the workflow on the next item but that is taking forever. 

 

Is there a way to do it as a site workflow that will query all of items, divide them and only assign those to person one, then do the same for everyone else? 

 

 

Tough one! Would something like this work?



 



ItemCollection = the items



ItemCount = the number of items in the collection



ItemIndex = pointer indicating which item is being handled



UnusedItem = variable that holds an item that won't be used



Item = variable that holds an item that will be used



 



UserCollection = the users



 



Set ItemIndex to 0 (the first item)



 



For Each Item in ItemCollection (sets UnusedItem; terminate if ItemIndex >= ItemCount)



  ForEach User in UserCollection (terminate if ItemIndex >= ItemCount)



    If ItemIndex < ItemCount



      Collection Operation > set Item = the item in ItemCollection at index "ItemIndex"
      Assign Item to User



      ItemIndex = ItemIndex + 1



  Next User



Next Item



 



 


Reply