need background script to close change and update comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â02-08-2021 10:04 PM
Hi Team,
I want to close 105 changes with additional comments" change closed manually". Please let me know the background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â02-08-2021 10:24 PM
Hi There,
Please write a background script like this :
var chg = new GlideRecord('change_request');
chg.addQuery('state','what ever condition you want to give to filter your 105 changes');
chg.query();
while(chg.next())
{
chg.comments='change closed manually';
chg.update();
}
Please mark this answer as correct and helpful if it resolves the query and helpful alone if it lead you in right direction.
Thanks,
Mohit Kaushik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â02-08-2021 10:37 PM
Hi ,
Thanks for reply.one doubt, where it is mentioned to change the state to close.
please confirm the below query added,
chg.addQuery('state','numberINFG-CHG0031009,FG-CHG0031102,FG-CHG0031047,+etcc)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â02-08-2021 10:43 PM
Please check the script I shared
Regards
Ankur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â02-08-2021 10:47 PM
oops sorry,
please add this line to your code inside the while loop:
chg.state=3;
chg.setWorkflow(false);
Thanks,
Mohit Kaushik