cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
romankorchak2
Helper I
Helper I

Get next item from another list

Hi All

I have 2 lists: 
==== Tasks ====

- ID -  ,  - Title - ,  - LastUserID - 

1            Task1          3

2             Task2          6

....... And so on

 And another list -

  ===== Users ======

 - ID -    - User -  
1         User1

3        User3

4       User4

6      User6

7       User7

...... And so on

 

And I need the flow that would go through all the Tasks and set LastUserId to next from current, so Tasks list would look like

 

- ID -  ,  - Title - ,  - LastUserID - 

1            Task1          4

2             Task2          7

 

And I just cannot figure it out how to do it

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
QJappie22
Resolver II
Resolver II

You first need to use the 'Get items' action from the 'Tasks' list and after that start a for-each loop on the output. In the for-each loop, use the 'Get items' action again, but this time on the 'Users' list and make sure you have the 'Top Count' set to 1 and put the following Odata query in the action:

"Id gt LastUserID"

Do this without the quotes and make sure you use the dynamic value of LastUserID.

 

This will get you an array with one user which is the next user in the list. Update your task item with the Id of this user (This will put the 'Update item' action in an 'Apply to each' loop because it is an array, but it still updates only 1 task because you set the 'Top Count' to 1).

 

Tasks & users.png

View solution in original post

1 REPLY 1
QJappie22
Resolver II
Resolver II

You first need to use the 'Get items' action from the 'Tasks' list and after that start a for-each loop on the output. In the for-each loop, use the 'Get items' action again, but this time on the 'Users' list and make sure you have the 'Top Count' set to 1 and put the following Odata query in the action:

"Id gt LastUserID"

Do this without the quotes and make sure you use the dynamic value of LastUserID.

 

This will get you an array with one user which is the next user in the list. Update your task item with the Id of this user (This will put the 'Update item' action in an 'Apply to each' loop because it is an array, but it still updates only 1 task because you set the 'Top Count' to 1).

 

Tasks & users.png

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,250)