+ Start a Discussion
arsaniketsharmaarsaniketsharma 

disabling scheduled apex jobs

I want to disable the scheduled apex job, Is there any command in lightning to disable the scheduled job and not aborting the job
Pankaj ShakyaPankaj Shakya
Hi arsaniketsharma

I don't think salesforce has the feature to pause or deactivate a scheduled job temporarily. Deleting and recreating a job everytime for a minor change is quite painful. However, if you want to stop the job, use the following code in Anonymous window

for (CronTrigger job : [SELECT Id FROM CronTrigger]) {
system.abortJob(job.Id);
}

Regards 
Pankaj Shakya
arsaniketsharmaarsaniketsharma
Thanks for your reply Pankaj,
But the thing is that i am trying to disable and reEnable the scheduled job, I used abortJob() but it is not the thing what i needed.
Pankaj ShakyaPankaj Shakya
Actually Aniket, the thing is once a job has been created and scheduled, it's not editable. Even if you have to chage the schedule, you will have to delete the existing job and create a new one. So, Iam not sure whether this reEnabling of the same job is possible. 
arsaniketsharmaarsaniketsharma
Thank You Pankaj for your help, but i have been given a task to disable an apex job.