Cancelling Change request in Bulk

Shashank24
Kilo Explorer

Dear All,

We need to cancel some old CR's in bulk. And we can not update the same from list view as security does not allow us to do so. 

Could you please let us know if there is any alternative?

 

Thanks,

Shashank

1 REPLY 1

Kieran Anson
Kilo Patron

Hi Shashank,

You will need to run a fix script. I suggest building a query string based on your list view and save the query.

Right click the query to copy it.

find_real_file.png

Use the following fix script to move all the change requests to cancelled state.

var changeGR = new GlideRecord('change_request');
changeGR.addEncodedQuery('state=-2'); //add copied query into the ''
changeGR.query();

while(changeGR.next()){
	changeGR.setValue( 'state' , '4');
	//changeGR.setValue( 'work_notes' , 'Change canceled in bulk due to age') //example of adding work note to changes as part of being canceled.
	changeGR.update();
}