For each item not working with MRV (Multi row Variable) (Reference variable)

rafaelalves4337
Tera Contributor

I have created a form to add users to Servicenow groups.

 

For that I created a MRV with 2 reference fields (User name and Group name:

Screenshot_197.jpg

 

My flow is not passing the For Each Item step, can someone please tell me what is the right way to add the users from that reference inside MRV to the group.

 

Screenshot_199.jpg

1 ACCEPTED SOLUTION

James Chun
Kilo Patron

Hi @rafaelalves4337,

 

The Flow looks ok to me, can you share some screenshots of individual actions?

I have created something similar in the PDI and it works fine, note that it will throw an error if the user is already a member of the group.

JamesChun_0-1717097876056.png

 

And what did you mean by is not passing the For Each Item step? Did you get an error of some sort?

 

View solution in original post

11 REPLIES 11

jonsan09
Giga Sage
Giga Sage

Take a look at this post: https://www.servicenow.com/community/now-platform-forum/how-do-i-iterate-through-a-multi-row-variabl...

 

If that still doesn't work you may need to create a custom action to use with the "For Each" step. (KB0793340) Here is a community post on how to create the custom action: https://www.servicenow.com/community/developer-blog/using-list-collector-in-flow-designer-for-each-l...

Hello @jonsan09 ,

 

None of that is working for me.

James Chun
Kilo Patron

Hi @rafaelalves4337,

 

The Flow looks ok to me, can you share some screenshots of individual actions?

I have created something similar in the PDI and it works fine, note that it will throw an error if the user is already a member of the group.

JamesChun_0-1717097876056.png

 

And what did you mean by is not passing the For Each Item step? Did you get an error of some sort?

 

@James Chun 

 

I just changed mine to match yours and now it worked partially, it's 2 users in that MRV (2 rows), but the flow only got the first user, the second user was not added to the group.

 

Screenshot_200.jpg