ServiceNow catalog item multi row variable set

Reddy39
Tera Expert

Hi Team,

I have a catalog item with two Multi-Row Variable Sets (MRVS). Each MRVS contains a reference variable.

Based on the Request Type, I need to send the approval to the reference variable inside the appropriate MRVS, and this must be handled using Flow Designer.

However, I am unable to retrieve the reference variable value from the MRVS in Flow Designer.

Requirement:

If Request Type = test1, send the approval to the reference variable in the first MRVS

If Request Type = test2, send the approval to the reference variable in the second MRVS

Can someone please help me with how to access MRVS variables in Flow Designer and route the approval accordingly?

Thank you.

2 REPLIES 2

OlaN
Tera Sage
Tera Sage

Hi,

This is going to be a bit complicated.

Even though you might have a direct reference to a user, you're still using a Multi Row Variable Set.

This means the users of the form can add zero or more rows to this set.

So if a user adds 3 lines, which one of the users should be the approver? First one? All of them?

 

If you intend to go forward with this, then you'd need to do it in these steps.

Create a Flow Variable.
Retrieve the MRVS data.
Loop through all the MRVS data, and store the selected user in the Flow variable.

Do a lookup of user-records based on the data stored in the Flow variable.

Use the found records to ask for approval to the correct people.

Ankur Bawiskar
Tera Patron
Tera Patron

@Reddy39 

You can use a flow variable of type string which does the calculation

Use "Set Flow Variables" flow logic and use script like this and then use this Flow Variable in "Ask for Approval" scipt

I assume you have only 1 row in each MRVS, ensure you give correct variable set name, value to compare and variable name

var mrvs1 = fd_data.trigger.request_item.variables.mrvsVariableSet1;

var mrvs2 = fd_data.trigger.request_item.variables.mrvsVariableSet2;

var requestType = fd_data.trigger.request_item.variables.variableName;

if (requestType == 'test1') {
    var parsedData = JSON.parse(mrvs1);
    return parsedData[0].approverVariable1.toString();
} else {
    var parsedData = JSON.parse(mrvs2);
    return parsedData[0].approverVariable2.toString();
}

AnkurBawiskar_0-1765793407949.png

 

 

You can use Scripted Flow Approval and dynamically decide to whom it has to go

Scripted Approvals in Flow Designer with Flow Variables 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader