Process for Bulk closure of 3000+ aging incidents and request tasks / catalog tasks to update fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 12:39 PM
Process for Bulk closure of 3000+ aging incidents and request tasks / catalog tasks?
Which fields (like Worknotes, Resolution) to be updated when Bulk Closure of 3000+ aging incidents and request tasks / catalog tasks ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 12:42 PM
Depends on the business process and/or what you are trying to achieve. Do you want to leave a comment/resolution note for the customer? Do you want notifications to be sent out? There are a few things to think about here. I personally would recommend posting an additional comment to state that the case was closed as part of a bulk action (and presenting the customer an option to re-open if they think it was a mistake) and updating the status to either Cancelled or Closed Incomplete via fix script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 01:34 PM - edited 01-21-2025 01:35 PM
Hi @VIKASM535239375 I am wondering why do you want to close 3000+ Incidents. Typically, if the Incident is put into Resolved status, then in 7 days, the Incidents will be closed automatically. However, what I didn't understand is 3000+ incidents are not resolved and you want to close it without resolution notes? If you have strong business case to close 3000+ Incident, then updating Incident resolution notes with the reason of why the Incidents were closed can be updated. Same goes to Catalog tasks, updating the additional comments with reason of closure will be beneficial.
Regards,
Gagan k
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 09:23 PM
You can achieve this using a background script, but before proceeding, keep the following points in mind:
- For incidents: Resolution notes are mandatory, so ensure these are added in the script.
- On closure: Users will receive email notifications, which could result in a single user receiving multiple emails.
- SLAs: These may be canceled or closed during the process.
For SC tasks, similar considerations apply. However, note that once SC tasks are closed, the associated RITM and REQ will also be closed, potentially triggering multiple email notifications.
Additionally, avoid closing all 3,000 records at once. Process them in smaller batches of 500 or 1,000 records.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 09:53 PM
Process for Bulk Closure
- Define Criteria for Closure
- Run Queries to Validate Records
Perform Bulk Closure:
- Use a Background Script for mass updates in ServiceNow.
- Test the Script in Sub-Production
Fields to Update During Bulk Closure
- Work Notes (comments)
- Resolution (close_notes)
- State (state)
- Resolution Code (close_code)
- SLA (task_sla Table)
Sample Background Script:
var gr = new GlideRecord('incident'); // Replace 'incident' with 'sc_task' or relevant table
gr.addQuery('state', 'Resolved'); // Adjust criteria as needed
gr.addQuery('updated', '<', '2024-06-01'); // Replace with appropriate date filter
gr.query();
var counter = 0; // To track closed records
while (gr.next()) {
// Add work notes and resolution details
gr.comments = "Task closed as part of bulk operation due to aging.";
gr.setValue('close_notes', 'Closed due to inactivity or aging policy.');
// Update state and resolution fields
gr.setValue('state', 'Closed');
gr.setValue('close_code', 'Closed/Resolved by Caller');
// Stop SLAs
var slaGR = new GlideRecord('task_sla');
slaGR.addQuery('task', gr.sys_id);
slaGR.query();
while (slaGR.next()) {
slaGR.setValue('stage', 'paused'); // Pause SLAs
slaGR.update();
}
// Avoid notifications
gr.setWorkflow(false);
// Save the changes
gr.update();
counter++;
}
gs.print(counter + " records were closed successfully.");