Kill the scheduled job

sonali_panda
Giga Expert

Hi All

We have a scheduled job running which has to delete records from task table. It needs to delete 400000 records. Its deleting only 20K per day.

Because of the scheduled job, instance has become slow.

We want to run the scheduled job during the non business hours.

Is it possible to kill the scheduled job automctically when we business hours starts. lets say it starts at 8 am, Can we kill the scheduled job automatically.

Manually we can but is it possible to automate that.

Thanks

Sonali

12 REPLIES 12

Kalaiarasan Pus
Giga Sage

Well, I do not understand why would someone want to delete records instead of either archiving it or making them active false.


I assume you must have already thought about this, which means you would want to deletion of records in chunks.



You can try using chooseWindow method as it would allow you to do batch based processing of records.


http://wiki.servicenow.com/index.php?title=Scoped_GlideRecord_API_Reference#chooseWindow.28Number_f....


divya mishra
Tera Guru

Hey Sonali,



Better if you setLimit(x no. of records), which obliviously you can figure out a range how much deletion is possible during the starting of business hours



post me your feedback


Please Hit ✅Correct, ��Helpful, or ��Like depending on the impact of the response


Have a lovely day ahead




Regards,


Divya Mishra


Hi Kalai/Divya,


Yeah i can do that, but there isnt a way to automatically kill it in 12 hrs or so?


I think there are ways to do that using workflows but i don't think so via a scheduled job.