The CreatorCon Call for Content is officially open! Get started here.

What is the best way to handle Multi Row Variable Set in Flow Designer?

WaseemM
Giga Expert

Hi Guys,

 

I have a catalog that includes an MRVS (Multi-Row Variable Set). When I submit the catalog, the values are returned as an array, requiring me to use a foreach loop to process the request. I want to design the flow to handle a single instance, but if the catalog is submitted with multiple rows, the flow should trigger separately for each row. Essentially, I want to move the loop outside of the flow designer, as the flow is intended to operate on individual instances.

 

Thanks!

1 ACCEPTED SOLUTION

Hello @Nilesh Wahule,

 

Thanks for your response, I will create flow variables and include them in a foreach loop to extract values from the variable set. Then, I’ll create a new Sub flow, move everything from the main flow into the Sub flow, and remove the "wait for condition" checkbox. Inside the Sub flow, I’ll create a RITM to ensure the parent RITM is closed at the end of the main flow loop. This way, individual RITMs can be tracked independently without waiting for the parent RITM to close. However, I was looking for alternatives to this method but any how ending up using it.

 

@Ankur Bawiskar & @Runjay Patel Thank you for your inputs and suggestions!

View solution in original post

9 REPLIES 9

Hello @Ankur Bawiskar and @Runjay Patel ,

 

I am designing a flow for creating new Virtual Servers. These MRVS will offer different options, such as selecting the operating system and choosing between environments like Enterprise or DMZ networks. Depending on the specific request, I have various subflows and actions that need to be executed. Therefore, using a foreach loop isn't ideal in my opinion, as it would make the process more complex.

 

When creating an RITM, there are no default fields available to map my variables. I would need to either create fields in the global service request table, which our internal SNOW team has denied, or use a custom table to store the variables and reference them in the flow designer using the RITM. Since creating a custom table incurs additional costs, I'm looking for an alternative solution to avoid that option.

Hi @WaseemM ,

 

Based on the discussion above, I understand that you have a different processes to follow for each item selected in MVRS, but even in that case, sub flows makes much more sense. Only issue will be you wont be having a record for it for tracking purpose. That problem also can be solved by creating a child tasks as each for one MVRS row where you will populate the fields dynamically, like short description and description. If you have more data to populate you can always go with key value pair details in the description field.

 

The need to store the values in the custom table occurs when you have too many values to store and process upon. If you have fewer scenarios with the combinations of the values, you can directly implemented in the logic part instead of storing them in the table.

 

In my Opinion, Creating a SC TASK with parallel flow execution makes more sense to achieve requirement by bypassing custom table creation if you have fewer combinations for the processes.

---------------------------------------------------------------------------------------------------

Please mark my answer as helpful/correct if it resolves your query.

Thanks,
Nilesh Wahule

---------------------------------------------------------------------------------------------------

 

Hello @Nilesh Wahule,

 

Thanks for your response, I will create flow variables and include them in a foreach loop to extract values from the variable set. Then, I’ll create a new Sub flow, move everything from the main flow into the Sub flow, and remove the "wait for condition" checkbox. Inside the Sub flow, I’ll create a RITM to ensure the parent RITM is closed at the end of the main flow loop. This way, individual RITMs can be tracked independently without waiting for the parent RITM to close. However, I was looking for alternatives to this method but any how ending up using it.

 

@Ankur Bawiskar & @Runjay Patel Thank you for your inputs and suggestions!

Hi @WaseemM ,

 

Yes you can do that but have to write logic to to create two task if MRVS returning one record and trigger the sub flow for each task.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

Hi @WaseemM ,

 

Thank you for marking my solution as helpful! The community now supports multi-solution acceptance, allowing you to accept multiple answers.