Quantcast
Channel: Blog - ServiceNow Elite
Viewing all articles
Browse latest Browse all 190

Insert variable Info into Catalog task description

$
0
0

Here is a script I use sometimes to insert variable information into a catalog task description.

I prefer to use the Variable Editor instead of this method.  However there are certain situations it is nice to use.

//insert variables on task if populated
var varown = new GlideRecord('sc_item_option_mtom');
varown.addQuery("request_item", current.sys_id);
varown.query();
while (varown.next()){
var visible = varown.sc_item_option.item_option_new.visible_summary;
//var question = Packages.com.glideapp.questionset.Question.getQuestion(varown.sc_item_option.item_option_new);
var question = GlideappQuestion.getQuestion(varown.sc_item_option.item_option_new); 
question.setValue(varown.sc_item_option.value);

if((question.getLabel() != '') && (question.getDisplayValue() != '') && (varown.sc_item_option.value != '') && (varown.sc_item_option.value != "0") && (varown.sc_item_option.value != "false")) {
catTask.description += "\n" + " " + question.getLabel() + " = " + question.getDisplayValue();
}
}

Viewing all articles
Browse latest Browse all 190

Trending Articles