How to Close Multiple SCTASK?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 08:18 AM - edited 08-21-2024 08:30 AM
I'm very new in ServiceNow and I would like to know how to close Multiple SCTASK.
I was given the job of closing all aging tickets and was granted an administrative role.
Can you please help me with the best practice on how to do this?
I have mandatory fields before you can close a task.
Which account should I use to assign all these tickets? (should I assign these to the admin account?)
No Script for now please if possible.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 08:29 AM
@JLOx Best way to close all of these tickets would be via a background or fix script. You can create a GlideRecord query to fetch those SC Tasks which you would like to close and run this script to change their state to closed complete.
Here is a sample script.
// Query to find the SCTASKs you want to close
var taskGR = new GlideRecord('sc_task');
// Add filters to narrow down the tasks you want to close
// For example, to close tasks in a specific RITM
taskGR.addQuery('request_item', 'RITM1234567');
// Uncomment and modify the line below if you want to filter by another field, like the current state
// taskGR.addQuery('state', '1'); // 1 typically represents the 'New' state
taskGR.query();
while (taskGR.next()) {
// Set the state to "Closed Complete" (7 is usually the value for this state, but verify in your instance)
taskGR.state = 3; // or 7 depending on your workflow, adjust as needed
// Optionally, you can set the close notes or other fields
taskGR.close_notes = 'Closed via script';
// Update the record
taskGR.update();
}
gs.print('Tasks closed: ' + taskGR.getRowCount());
Please make sure to configure the addQuery correctly before running the script. Also do not run this script directly on your production instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 08:32 AM
Hi Sandeep,
Thanks for your prompt reply. As of now, I have very limited knowledge of scripting. Can we do this via filtering ticket and selecting the tickets needs to be close

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 08:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 08:39 AM
HI @JLOx
SCTask must be closed manually based on the action done on same like closed completed or incomplete or skip.
Open the tabel sc_task.list in navigation
A list view wil open
Select one task and with down arrow key , select all task you want to close. like below.
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]
****************************************************************************************************************