- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 09:17 AM
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!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 09:23 AM
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();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 09:23 AM
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();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 09:25 AM
Else try from list view. Follow link from check.
Also, bit of typo in above script
Replace
getchagne.setWorkflow(false);
with
getchange.setWorkflow(false);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 10:53 AM
I see you marked the comment helpful. If you got what was expected kindly close the thread by marking suitable answer correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2025 04:44 AM
Thanks for sharing