How to iterate through a MRVS variables and assign it to a flow variables in flow designer ?

nivea
Tera Contributor

Hi Team,

 

I've a MRVS named 'Laptop Models' in which I've two variables (select box, single line text).

 

Select box variable has two options: Windows and Mac.

 

User will select either anyone laptop model or both and submit the form. We need to trigger two separate catalog tasks if both options are selected for a single RITM.

 

To achieve this, I created two flow variables (Dell, Mac) with type 'True/false' and wrote the below script to assign the answer to each flow variables. 

nivea_0-1721804053594.png

 

If any of the flow variables are true, then I'm triggering the catalog tasks separately in the flow. But, I couldn't get all the rows output if I do like this and also I'm not getting any value in flow variables. So, my flow ends with a error and proceeding further.

 

Can anyone please suggest on how to achieve this?

 

Thanks,

Nivea.

1 ACCEPTED SOLUTION

HrishabhKumar
Kilo Sage

Hi @nivea ,

The better way would be to use "For each" condition, it's literally very useful for MRVS.

check this article for reference : https://www.servicenow.com/community/workflow-automation-articles/how-to-use-multirow-variable-sets-...

 

Thanks.

Hope it helps.

you can mark it helpful and accept solution, if it helps.

View solution in original post

4 REPLIES 4

Dnyaneshwaree
Mega Sage

Hello @nivea ,

For iterations generally "For each" loop used in the flow. So, for your case you can use MVRS 'Laptop Models' variable in "For each" loop so it can iterate for each value present in the MRVS i.e., Windows and Mac.
Then you can add if blocks for both options  i.e., Windows and Mac. and add create catalog task for each if block resp.

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru

Hey @Dnyaneshwaree ,

 

Thank you so much for your suggestion!

 

As you can see my MRVS in the below image, users will add both options in a request as Laptop is a select box variable. Can you elaborate more on how to iterate through each lines in the select box variable value by using "for each" loop if I select the MRVS in it.

 

nivea_0-1721805733486.png

Thanks,

Nivea.

HrishabhKumar
Kilo Sage

Hi @nivea ,

The better way would be to use "For each" condition, it's literally very useful for MRVS.

check this article for reference : https://www.servicenow.com/community/workflow-automation-articles/how-to-use-multirow-variable-sets-...

 

Thanks.

Hope it helps.

you can mark it helpful and accept solution, if it helps.

Thank you so much @HrishabhKumar for sharing the article !