- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 04:27 PM
Hello,
I have a variable set called "User Data" that populates on my service portal requests. One of these variables is a "location" variable. I am building a workflow that needs to check for this location, then generate tasks accordingly. I'm using a basic "IF" statement in the workflow to check, but I'm unable to figure out what's going wrong.
How do I check for a variable set variable in a workflow?
Using current.variable_pool.location doesn't work, as it doesn't seem that the variable set location variable exists within the variable pool.
Perhaps the variable I need is stored on the Request table? In which case how do I call that?
Here is the "IF" statement that I'm using:
---------------------------------------------------------------------------------
answer = ifScript();
function ifScript() {
if (current.request.requested_for.location == "30bc3793db191fc014a0777a8c9619d7")
return 'yes';
else
return 'no';
}
---------------------------------------------------------------------------------
Thank you for all the help!
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 05:08 PM
Hi,
You should try accessing the variable by the following call:
current.variables.variable_name;
But that won't work for Multi-Row Variable Sets. To access multi-row variable set's variables, you need to specify the internal name of the variable set:
current.variables.variable_set_internal_name.variable_name;
Note: Accessing the variables using the variable set internal name, i.e.,
current.variables.variable_set_internal_name.variable_name,
works for both Multi-Row Variable set and Single Row Variable Set.
Hope this helps!
Thanks,
Manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 04:33 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 04:33 PM
Hi Zach,
Try this:
answer = ifScript();
function ifScript() {
if (current.variables.location == "30bc3793db191fc014a0777a8c9619d7")
return 'yes';
else
return 'no';
}
Regards,
Raf

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 05:08 PM
Hi,
You should try accessing the variable by the following call:
current.variables.variable_name;
But that won't work for Multi-Row Variable Sets. To access multi-row variable set's variables, you need to specify the internal name of the variable set:
current.variables.variable_set_internal_name.variable_name;
Note: Accessing the variables using the variable set internal name, i.e.,
current.variables.variable_set_internal_name.variable_name,
works for both Multi-Row Variable set and Single Row Variable Set.
Hope this helps!
Thanks,
Manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 09:39 PM
Hi,
if you want to get value from request table then do this
current.request.requested_for.location
if you want to get it from some variable then irrespective whether it is inside variable set or not use this
current.variables.<variableName>
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader