I want to update a incident category without increased count in updates field

ServiceNow Use6
Tera Guru

Hi,

I wrote this code, but updates increased. Kindly help.

 

var gr = new GlideRecord('incident');
gr.addQuery('number', 'INC0007001');
gr.query();
if(gr.next()){
	gr.category = 'network';
	gr.autoSysFields(true);
	gr.update();
}
gs.addInfoMessage('the total number of updates are ' + gr.sys_mod_count);
2 ACCEPTED SOLUTIONS

Rafael Batistot
Kilo Patron

Hi @ServiceNow Use6 

 


Use: 

 

gr.autoSysFields(false);

gr.setWorkflow(false); // additional to ensures no business rules, flows, or scripts are triggered

 

If this response was helpful, please mark it as Helpful and, if applicable, as Correct, this helps other users find accurate and useful information more easily.

View solution in original post

ServiceNow Use6
Tera Guru

This is the corrected script

 

var gr = new GlideRecord('incident');
gr.addQuery('number', 'INC0007001');
gr.query();
if(gr.next()){
	gr.category = 'network';
	gr.autoSysFields(false);
	gr.setWorkflow(false);
	gr.update();
}
gs.addInfoMessage('the total number of updates are ' + gr.sys_mod_count);

View solution in original post

5 REPLIES 5

ServiceNow Use6
Tera Guru

This is the corrected script

 

var gr = new GlideRecord('incident');
gr.addQuery('number', 'INC0007001');
gr.query();
if(gr.next()){
	gr.category = 'network';
	gr.autoSysFields(false);
	gr.setWorkflow(false);
	gr.update();
}
gs.addInfoMessage('the total number of updates are ' + gr.sys_mod_count);