You need to sign in to do that
Don't have an account?
Is there a way to mass delete all Scheduled Jobs? After Sandbox refresh
There is an "idea" to disable jobs, but is there a way to mass delete them all using Apex? Would like to delete the following:
Dashboard Refresh
Data Export
Scheduled Apex
Report Run
https://sites.secure.force.com/success/ideaView?id=08730000000HBnU
IF there is a way to do this, I also would like to know how. I have a number of secheduled jobs that have to be deleted everytime we refresh the sandbox. There has got to be an easier or quicker way to do this.
kent
You can use Dataloader to delete them. The object is called scheduled jobs but you have to click the checkbox to show All.
List<CronTrigger> cronstodelete = [Select Id from CronTrigger Limit 100];
for(CronTrigger CT: cronstodelete){
System.abortjob(CT.Id);
}
Credits to someone
What I ended up doing was running the System.abortJob() method in a @future method that gets spinned up by the SandboxPostCopy-interface class that runs automatically after sandbox refresh/create. That class is allowed to spin up up to 50 @future methods, each of which can contain 150 DMLs (System.abortJob() methods).
Execute as many times as needed until they are all aborted.