About

Monday 29 November 2021

when problem ticket is closed then related incidents should close automatically in Servicenow(SNOW)

We need to create an after business rule in the probelm table with condition and script

/*Sample code*/


var gr = new GlideRecord('incident');

gr.addActiveQuery(); // cross check for only active incidents

gr.addQuery('problem_id',current.sys_id);

gr.query();

while(gr.next()){

gr.state = '6';

gr.close_code = 'Solved(Woek Around)';

gr.close_notes = 'The incident is resolved';

gr.update();

}


gs.addInfoMessage('The incident' +gr.number+ 'is Resolved');