Bulk close records with comments or worknotes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi All,
I don't want to send email notifications and bulk close change records. Why is my fix script not updating the comments and worknotes ?
My code: -
var chg = new GlideRecord('change_request');
chg.addEncodedQuery('<YOUR_ENCODED_QUERY>');
chg.query();
gs.info("Changes found: " + chg.getRowCount());
while (chg.next()) {
chg.setWorkflow(false);
chg.autoSysFields(false);
chg.state = 3;
chg.comments = "This change is bulk closed";
chg.work_notes = "This change is bulk closed";
chg.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
update as this
See if any data policy is blocking the closure
var chg = new GlideRecord('change_request');
chg.addEncodedQuery('<YOUR_ENCODED_QUERY>');
chg.query();
gs.info("Changes found: " + chg.getRowCount());
while (chg.next()) {
chg.state = 3;
chg.comments = "This change is bulk closed";
chg.work_notes = "This change is bulk closed";
chg.setUseEngines(false); // disable data policy if any
chg.setWorkflow(false);
chg.autoSysFields(false);
chg.update();
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader