background script to close bulk sctasks
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2025 11:56 PM
Hi All,
Could you please help me to close bulk tasks from background scripts. is there any script available.
Ex : TASK0012345678
Thank you in Advance.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2025 06:35 AM
Hi @Swathi KC
You can do via list view as well.
https://www.servicenow.com/community/developer-forum/how-to-bulk-close-incidents/m-p/2123592
*************************************************************************************************************
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]
****************************************************************************************************************
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]
****************************************************************************************************************
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2025 07:25 AM
Hi @Swathi KC ,
A sample background Script:
var grTask = new GlideRecord('task');
grTask.addQuery('number', 'TASK0001002');
grTask.setLimit(1);
grTask.query();
if(grTask.next()) {
grTask.setValue('active', false);
grTask.update();
}
For Bulk tickets:
var grTask = new GlideRecord('task');
grTask.addQuery('number', 'IN', 'TASK0001001,TASK0001002,TASK0001003');
grTask.query();
grTask.setValue('active', false);
grTask.updateMultiple();
----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.
Mark this as Helpful / Accept the Solution if this helps.