Get variable value on server side script (not display value)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2019 07:49 AM
Hi,
On business rule / workflow script - how can i get the value of a variable ( not display value, value)?
for example - variable named model
var req = new GlideRecord('sc_req_item');
req.addQuery('number','RITM0219702');
req.query();
if (req.next()){
gs.print(req.getValue('variables.model')); // this is not working - return null
gs.print(req.getDisplayValue('variables.model')); // this is working and return the display value
}
Anyone know the reason?
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2019 07:50 AM
Hi,
req.variables.model
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 08:14 AM
Hi Allen,
I would like to use the getValue method. the reason is that i'm building something dynamic, so i don't know the variable name in advance.
thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 08:24 AM
Hello, I'm not understanding as you'd need to know what to get the value of.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2019 01:22 AM
Hi,
I have build a configuration table where it is defined for each catalog item, which variable is relevant for this process.
so in my code, i use this configuration table to get the variable value.