The CreatorCon Call for Content is officially open! Get started here.

Bulk close open Change Requests

Chris17
Tera Contributor

Hello,

I currently have a requirement to close over 70 open Change Request records. They are in a variety of states, and I was hoping there was a way I could run a script to automatically set them all to Closed. Is this possible?

 

Thanks!

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Something as below should help.

var getchange=new GlideRecord('change_request');
getchange.addEncodedQuery('numberIN'); //eg. numberINCHG0030076,CHG0030091
getchange.query();
while(getchange.next())
{
getchange.state='3';
getchange.work_notes='Closing in bulk';
getchagne.setWorkflow(false);
getchange.update();
}

View solution in original post

7 REPLIES 7

Jaspal Singh
Mega Patron
Mega Patron

Something as below should help.

var getchange=new GlideRecord('change_request');
getchange.addEncodedQuery('numberIN'); //eg. numberINCHG0030076,CHG0030091
getchange.query();
while(getchange.next())
{
getchange.state='3';
getchange.work_notes='Closing in bulk';
getchagne.setWorkflow(false);
getchange.update();
}

Else try from list view. Follow link from check.

Also, bit of typo in above script

Replace

getchagne.setWorkflow(false);

with

getchange.setWorkflow(false);

I see you marked the comment helpful. If you got what was expected kindly close the thread by marking suitable answer correct.

Thanks for sharing