- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2022 02:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2022 02:31 PM
Or in the screenshot the question label is the same for multiple questions.
"What do you want to do?" and in the return object you are storing it as the key
obj[vname]
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2022 11:38 AM
Issue is now resolved. I had to add an if condition to look for only populated display values.
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(grRitm.sys_id); // requested item sys_id
set.setTaskID(grRitm.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i = 0; i < vs.size(); i++) {
var vname = vs.get(i).getLabel().toString();
if(vs.get(i).getDisplayValue() != '') {
obj[vname] = {
"display_value": vs.get(i).getDisplayValue(),
"value": vs.get(i).getValue().toString()
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2022 01:02 PM
But your screenshot of SCTASK had a value for the question...right?
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2022 01:07 AM
Hi,
Because there were multiple questions with the same name, it was displaying the question which didn't have a value. So had to add an if condition to only display the variables that had values.