- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2018 12:47 PM
I am attempting to pass Service Catalog variables from one RITM to another (via ebonding), however, one of the Packages that I was using to accomplish this, GlideappAbstractChoiceListQuestion, is not available within a scoped application. Does anyone know an alternative?
Essentially, I am pulling data from the sc_item_option_mtom table, which is working, but if the data returned is referenced from another table (sys_user, cmn_location, etc) it is only showing the Sys_ID, instead of a friendly Display Value.
Below is an example of a simple script that can be run in Scripts - Background. This WILL work in Global Scope, but I get: "Error: GlideappAbstractChoiceListQuestion is not allowed in scoped applications" if run in my scope.
var varown = new GlideRecord('sc_item_option_mtom');
varown.addQuery("request_item", 'SYS_ID HERE');
varown.addQuery("sc_item_option.item_option_new.type","NOT IN","12,20,24,19");
varown.orderBy("sc_item_option.order");
varown.query();
while (varown.next()){
var visible = varown.sc_item_option.item_option_new.visible_summary;
var question = GlideappAbstractChoiceListQuestion.getQuestion(varown.sc_item_option.item_option_new);
question.setValue(varown.sc_item_option.value);
if(question.getDisplayValue() != ""){
gs.print('Question:'+question.getLabel());
gs.print('Variable Name:'+question.name);
gs.print('Value:'+question.getDisplayValue() + '\n\n');
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2018 11:40 AM
One more correction
var item = new GlideRecord('sc_req_item');
item.addQuery('number','RITM0010001');
item.query();
if (item.next())
{
gs.info(item.number);
var varown = new GlideRecord('sc_item_option_mtom');
varown.addQuery('request_item', item.sys_id+'');
//varown.addQuery("sc_item_option.item_option_new.type","NOT IN","12,20,24,19");
varown.orderBy("sc_item_option.order");
varown.query();
while (varown.next())
{
//gs.info(varown.sc_item_option.item_option_new);
var visible = varown.sc_item_option.item_option_new.visible_summary;
if(varown.sc_item_option.item_option_new.getDisplayValue() != "" && typeof item.variables[varown.sc_item_option.item_option_new.name]!='undefined')
{ gs.info('Question:'+varown.sc_item_option.item_option_new.getDisplayValue()+' : '+item.variables[varown.sc_item_option.item_option_new.name].getDisplayValue());
}
}
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2018 11:40 AM
One more correction
var item = new GlideRecord('sc_req_item');
item.addQuery('number','RITM0010001');
item.query();
if (item.next())
{
gs.info(item.number);
var varown = new GlideRecord('sc_item_option_mtom');
varown.addQuery('request_item', item.sys_id+'');
//varown.addQuery("sc_item_option.item_option_new.type","NOT IN","12,20,24,19");
varown.orderBy("sc_item_option.order");
varown.query();
while (varown.next())
{
//gs.info(varown.sc_item_option.item_option_new);
var visible = varown.sc_item_option.item_option_new.visible_summary;
if(varown.sc_item_option.item_option_new.getDisplayValue() != "" && typeof item.variables[varown.sc_item_option.item_option_new.name]!='undefined')
{ gs.info('Question:'+varown.sc_item_option.item_option_new.getDisplayValue()+' : '+item.variables[varown.sc_item_option.item_option_new.name].getDisplayValue());
}
}
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2018 09:40 AM
Did it work?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2018 11:51 AM
I just was able to insert it into my code and it IS working! I get Warning errors when it's run, but it executes and populates all of the display values that I needed. Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2018 10:19 PM
Also check the below thread, which can help print questions
https://community.servicenow.com/community?id=community_question&sys_id=8ad37d68dbf85b084837f3231f961944&view_source=searchResult
Please mark this response as correct or helpful if it assisted you with your question.