- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 07:38 AM
Variables is empty for GlideRecord query record, even though it has variables.
var req = new GlideRecord('sc_req_item');
req.addQuery('sys_id','=','XXXXXXXXXXXXX');
req.query();
while (req.next()) {
// req.variables is empty
}
How to get the variables value ?
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2018 06:52 AM
Figured out that the value of variables is empty on client script but works fine on business script.
Prateek's solution is partially working on client script but need to query two more additional tables sc_item_option and item_option_new to get variable value and name.
Thanks for all your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 07:50 AM
That is wierd, I tested this. What kind of script are you running this in? Background script, fix script widget server script?
Are you sure the sysid is correct.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 07:47 AM
var req = new GlideRecord('sc_req_item');
req.get('sys_id','XXXXXXXXXXXXX');
gs.print(req.variables.<variable_name>);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 07:49 AM
The value is still empty.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 07:51 AM
can you share the screenshot? have you mentioned the correct sysid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 08:02 AM
Added the attachments to question.