How do I get the value of a field on the Question table from a Variable on a Requested Item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2016 11:54 AM
All,
I have created a True/False field on the Question table called Treat as Number/u_treat_as_number. I need to get the value of this field from a variable in a Requested Item.
From the GlideRecord of the Requested Item I can access the collection of variables and do a getGlideObject().getQuestion() to get the "question." However, I cannot find any documentation of what I actually have at that point and what properties and/or functions are available.
var question = varContent.getGlideObject().getQuestion(); //this works fine
var grQuestion = new GlideRecord('question');
grQuestion.get(question.getUniqueValue());
//grQuestion.getEncodedQuery() = question_text=org.mozilla.javascript.Undefined@b2cc24
var grQuestion = new GlideRecord('question');
grQuestion.get(question.sys_id);
//grQuestion.getEncodedQuery() = question_text=org.mozilla.javascript.Undefined@b2cc24
Any help would be greatly appreciated.
Respectfully,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2016 12:22 PM
Hey Robert,
Better check on script editor page for variables you can directly access it for glide and note it down and use where ever you want.
Hope this helps to you
Click like or helpful or correct if it helps you.
Cheers
Rithesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2016 01:13 PM
I found something that worked:
var question = varContent.getGlideObject().getQuestion();
var grQuestion = new GlideRecord('question'); | |||||||
grQuestion.get(question.getLabel()); | |||||||
var boolTreatAsNumber = grQuestion.u_treat_as_number; |