Access variables from a variable set in workflow

Vishwa Pandya19
Mega Sage

Hello,

I have a catalog item which contains a variable set called "Requested For Details Variables" (backend name: requested_for_details_variables).

I want to access the "Requested for" (backend name: rs_requested_for) variable from this variable set into the workflow to check the user name.

I have tried

current.variables.requested_for_details_variables.rs_requested_for.toString()

current.requested_for_details_variables.rs_requested_for.toString()

But nothing seems to work. 

Please help.

1 ACCEPTED SOLUTION

Shruti
Giga Sage

Hi,

Try current.variables.rs_requested_for or current.variables.rs_requested_for.toString()

View solution in original post

8 REPLIES 8

var mvrs = JSON.parse(current.variables.requested_for_details_variables);

for (var i = 0; i < mvrs.length; i++) {

var req_for = mvrs[i].rs_requested_for;

}

I'm so sorry, I just checked its a single row variable set. 

find_real_file.png

If rs_requested_for is a reference field, try current.variables.rs_requested_for.getDisplayValue() or current.variables.rs_requested_for.name

Ankur Bawiskar
Tera Patron

Hi,

you can access variable value like this for variable which is directly present in catalog item or present in single row variable set.

current.variables.rs_requested_for

Regards
Ankur

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