Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to force cancel change?

omkar2
Giga Contributor

I need to force cancel a change request, is there any script to it & where to run it?

1 ACCEPTED SOLUTION

change.setWorkflow(false); before your update(); statement.




var change = new GlideRecord('change_request');


change.get('<sys_id of change>');


change.setWorkflow(false);


change.state = 4;


change.update();


View solution in original post

13 REPLIES 13

Mike Allen
Mega Sage

I would pick your particular change:



find_real_file.png



Right-click on the header:


find_real_file.png



Change the state to Canceled:


find_real_file.png



And hit update.


Actually I cannot change the state from UI. I think its a broken change. Can you provide a script that can be run in background script?


Thanks.


omkar2
Giga Contributor

Can anyone provide a script that can be run in background script?


var change = new GlideRecord('change_request');


change.get('<sys_id of change>');


change.state = 4;


change.update();