Monday, January 29, 2018

Sample code to get the catalog variables in the ServiceNow workflow

var gr  = current ;
var firstName  = gr.variables['first_name'] ;
var lastName  = gr.variables['last_name'] ;

var fullName  = lastName.getGlideObject().getValue() + " " + firstName.getGlideObject().getValue() ; 

Sample code to restart servicenow workflow

var gr = new GlideRecord('sc_req_item');
gr.addQuery('number', 'RITM0106387');
gr.query();
if(gr.next()) {
var w = new Workflow();
         var context = w.startFlow('67755686db2c4b004620d2c75e96191e', gr, 'insert', '');
}