- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2016 07:19 AM
Hi,
I am trying to do this in a workflow. I am trying to check a value of particular 'catalog variable' from the submitted RITM, and the catalog variable varies for every catalog. I will pick this variable name from a table.
I am trying out the below script in the background, where action is the name of the catalog variable.
it is getting into the loop even if the value is NOT test.
var action = 'setas_actions';
var query1='ritm.variable_pool.'+action+'=test';
gs.print(query1);
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('number','RITM0022368');
ritm.addEncodedQuery(query1);
ritm.query();
if(ritm.next()){
//gs.print('ritm.variables.'+action);
gs.print('Hi');
}
Some help pls.
Thanks,
Sam
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2016 08:14 AM
If the variable is for the current ritm, you could do something like:
var variableName = 'varName'; //you would pull this dynamically from your table
var variableValue = current.variables[variableName];

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2016 08:14 AM
If the variable is for the current ritm, you could do something like:
var variableName = 'varName'; //you would pull this dynamically from your table
var variableValue = current.variables[variableName];
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2016 09:05 AM
Thanks Brad. Worked Perfectly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2019 08:25 AM
Thank you.
All of the articles older than this have people trying to use the "illegal" eval to try to handle this situation. Everyone needs to click "Helpful" on this.