- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 11:57 PM
Hi,
I need to get the field value of "question_text"
var grIncident = new GlideRecord('question');
returnValue = grIncident.get('8cdb154adb094810bda4d602ca961984');
returnValue = grIncident.get('940bd50adb094810bda4d602ca9619ca');
returnValue = grIncident.get('c64f3e3ddb014810bda4d602ca961961');
gs.log(returnValue); // logs true or false
gs.log(grIncident.question_text); // logs question value
With the above script i am getting only the question value of "c64f3e3ddb014810bda4d602ca961961" but i need all 3 values.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2019 12:16 AM
try the below code to get all the three values
var grIncident = new GlideRecord('question');
var questions =[];
var returnValue =[];
returnValue.push( grIncident.get('8cdb154adb094810bda4d602ca961984'));
questions.push(grIncident.question_text+'');
returnValue.push(grIncident.get('940bd50adb094810bda4d602ca9619ca'));
questions.push(grIncident.question_text+'');
returnValue.push(grIncident.get('c64f3e3ddb014810bda4d602ca961961'));
questions.push(grIncident.question_text+'');
gs.log(returnValue.toString()); // logs true or false
gs.log(questions.toString()); // logs question value
But I'm not sure on which use case you are applying this!!
-Satheesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2019 12:05 AM
Hi Hemanth,
Can you share the complete script here?
Update code as below; query for all the sys_ids and then print the value
also the table which holds the survey questions is survey_question_new; so query with this table
var grIncident = new GlideRecord('survey_question_new');
grIncident.addQuery('sys_id','IN','8cdb154adb094810bda4d602ca961984,940bd50adb094810bda4d602ca9619ca,c64f3e3ddb014810bda4d602ca961961');
grIncident.query();
while(grIncident.next()){
gs.info(grIncident.question_text);
}
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2019 12:16 AM
try the below code to get all the three values
var grIncident = new GlideRecord('question');
var questions =[];
var returnValue =[];
returnValue.push( grIncident.get('8cdb154adb094810bda4d602ca961984'));
questions.push(grIncident.question_text+'');
returnValue.push(grIncident.get('940bd50adb094810bda4d602ca9619ca'));
questions.push(grIncident.question_text+'');
returnValue.push(grIncident.get('c64f3e3ddb014810bda4d602ca961961'));
questions.push(grIncident.question_text+'');
gs.log(returnValue.toString()); // logs true or false
gs.log(questions.toString()); // logs question value
But I'm not sure on which use case you are applying this!!
-Satheesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2019 12:39 AM
It worked. Thanks a lot.. 🙂