I'm trying to create a workflow that will assign an item to someone based on who the last person was that a previous item was assigned to.
For example: There are three people: Person 1, Person 2 and Person 3. All of these people have been assigned items. I now have a NEW item and I need to know who to assign it to based on who got the last item. So, if person 2 was the last person to be assigned something, person 3 would be next.
The list is relatively large so I would first need to query those that have been assigned (obviously). I'm thinking my next step would be to get the ID of the last assigned item (highest item ID on the list - minus the new one of course), look at the person column and determine whos next from there.
My issue is that I cannot for the life of me figure out how to get that highest ID/last assigned item.
This would need to be a list workflow that runs everytime and new item is added and does not have a person assigned to it (some will be added with that person already in the column, others will not).
Any help would be appreciated.
Solved! Go to Solution.
@Nates_Mom....it's simple :)
Since you're requirement is to always get the value from the second latest item, we've hard coded the index value. Index numbering always starts from '0'.
Also just to make sure I get right data (in case multiple items gets created during almost same time), in my QL, I'll filter where Assigned To is not empty. If you put filter parameter then you won't need collection variable, index variable and collection operation action. You can simply store Assigned To value in SLT or PG variable but make sure you DO specify item limit in Output options and set as '1'.