cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Nates_Mom
Nintex Newbie

Comparing most recently created item with New item in List Workflow (getting previous item ID)

Jump to solution

Hi all,

 

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.

Labels: (1)
0 Kudos
Reply
1 Reply
Automation Master
Automation Master

Re: Comparing most recently created item with New item in List Workflow (getting previous item ID)

Jump to solution

@Nates_Mom....it's simple Smiley Happy

 

  1. First QL and sort it in descending order by ID (this way you'll have the latest ID on the top)
  2. Now in this QL get Assigned To as a collection
  3. Now create a number variable "num_Index" and set '1' as default value
  4. Use collection operation action
    1. Select collec_Assigned_To
    2. Select Get
    3. In Index, select num_Index
    4. Store it in either SLT or PG variable

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

View solution in original post

0 Kudos
Reply