I am trying to figure out a workflow to divide tasks evenly and keep them as close to even as possible.
I have a list that is updated with new items daily. I have five people that need to have these items assigned to them. The number of items created daily varies. Some days there may be two other days as many as 20. Is there a way to ensure that any new additions are equally distributed among the five people?
I have tried to use the math function divide on the collection but I get an error is the number can’t be divided by 5.
Any help would be appreciated.
Thanks in advance!
Solved! Go to Solution.
I would allocate based on a rotation of the 5 recipients.
Have a column in your list that keeps track of the recipient which stores the number 1 to 5.
The workflow would look up the number of the last recipient on the previous item, add one and populate the column of the new item. When the last number hits 5 it resets back to 1.
In the workflow you could have a switch statment with 5 branches and the workflow goes down the appropriate branch number based on the number in the column.
You could make this more dynamic by having a list with the 5 recipients and lookup that list to find the recipient based on the number and just have one task action in the workflow instead of 5 in a switch action.
To find the last item in the list just subtract 1 from the current item ID.
If items are likely to be deleted which would break the above you could do a lookup on the list to gather all the ID's and then use the MAX() inline function to find the highest ID or do a POP collection operation to get the last ID in the collection.
Thank you Simon,
This ended up working for a Site Workflow. Thanks so much.
Do you think there is a way to have this as a lit workflow instead?
I ask becasue I have one workflow that does basic cleanup then another that runs right after the assigning to update other fields and send a task. It would be most effecient to have all three of these workflows consolidated into one BUT, what I found with doing this as a list workflow is that since its firing on all items basically at the same time, all items end up getting assigned to person #1.
Workflow instance was just a suggestion to get a random number.
How about looking at the item ID.
Then say if it ends in
1 or 6 give it to number 1
2 or 7 give it to number 2
3 or 8 give it to number 3
4 or 9 give it to number 4
5 or 0 give it to number 5
That definely sounds like it could work. I'd say its worth playing with. I'll give it a try and see what happens. 🙂