You need to sign in to do that
Don't have an account?

Error : Schedulable class has jobs pending or in progress
I am trying to deploy one class which has implemented Schedulable interface.
But when I try to deploy it using ANT I am getting the following error :
"Schedulable class has jobs pending or in progress".
I am waiting for this to get resolved since more than 48 hrs and it doesn't seem to resolve.
What can be done in such case? How to deploy it to production? I tried to deploy by making packages but could not since the components in the package already exist in production and gives an error when I unzip the package. Please suggest what can be done in this situation.
Hi Bob,
Even I came across with the same issue. And I got the solution from here. Thanks again Bob.
I am facing this in a sandbox while saving one class that was scheduled. But I have already deleted that schedule.
Also would like to mention that there is no schedules Apex only scheduled reports in this sandbox.
Anyone any idea ????
Preventing my production move...... :(
Regards,
J
Hi ,
The reason for this error is because your apex class is used under scheduler class . You need to delete your scheduler or edit your scheduler class(by commenting out batch/apex class) so that it wont use such class which is required to delete .
Regards,
Mayank Joshi
Now this is just BRILLIANT!
So any time you change any of your global classes you just need to delete all your schedulers. Or you just duplicate the code that your scheduled classes need from the global classes (and update everything every time when business requirements change).
Not quite any time that you change a global class, but yes every time that you change a global class that is scheduled.
I try to develop these in managed packages if I can - that allows the classes to be upgraded while leaving the schedules in place. Obviously it also brings its own challenges, so it isn't a silver bullet.
>Not quite any time that you change a global class, but yes every time that you change a global class that is scheduled
For example my global class has methods for sending email messages to members of some groups (among other things).
It is not scheduled. But the sceduled classes use methods from this global class to report results.
I can not update the global class - unless I delete all schedules. I undestand why they tried to put additional "protection" in place but it failed miserably - now you have to copy-paste code from global classes into scheduled classes.
Or you have to delete all your schedules before you can make any changes to the global class
I had this problem just recently as well with no classes in progress or scheduled. Stumped me for quite some time. I ended up deleting the COMPLETED job that scheduled this task and was able to move forward.
Just sharing, haven't confirmed this one...
askmikem : How were you able to delete the COMPLETED job? I assume you are talking about the AsyncApexJob record where Status = 'Completed' - is this correct? When I try to delete AsyncApexJob records via Execute Anonymous I am not able to - any guidance will be much appreciated!
It means that you deleted your scheduled job.
It is ok if you have one or a couple. But if you have a few - you are pretty much doing it every time one of your global classes used in the scheduled class change. Soon enough you will give up and give up using scheduled apex.
Did you need to change a setting somewhere to be able to delete the completed job? I don't have an option to delete it from the UI.
Just Use System.abortJob('JOBID'); command under Developer console .
This will help to abort Job ,even if delete Option is not available under UI .
I tried all the suggestions but I am still unable to edit the scheduler or the class. The error I am getting is Error: Compile Error: Schedulable class has jobs pending or in progress at line 1 column 8
Is there any other way to resolve this. Though salesforce says this issue is fixed http://success.salesforce.com/issues_view?id=a1p30000000STwPAAW I don't think it has yet!
If you are able to find Job ID under Apex Job section then try to delete it using below Command from Developer Console :
System.abortJob('JOBID'); -- Pass JobID in quotes .Once ,it will be aborted then you can edit your scheduler class.
I tried killing all the jobs, but still I`m not able to save the class. I don`t see any pending jobs In the Apex Jobs list, I still get this Issue. Any suggestions? It`s been almost 24 hours since I deleted all jobs.
Any help would be appreciated.
Thanks.
Rakesh.
Hello Rakesh ,
You can get in touch with Salesforce Dev support . They can help you out to Delete Apex Job /Abort . If you are still struggling to save your class .
Thanks,
Just a quick added point about deleting the Scheduled Jobs. Do not delete the job from Apex Jobs, instead delete the job from Scheduled Jobs.
Good Luck.
Thanks Mike and Mayank. I had to contact support and they killed a dangling job.
P.S This was not production so I just killed all the Apex Jobs.
I m new to the salesforce and m trying to write the scheduler which will send the email to the employee on birthday..
But m not getting any mail due to the error "Schedulable class has jobs pending or in progress".
Thanks in advance..!
KUDOS
I am also having the issue with trying to edit an apex class and get the error:compile error: schedulable class has jobs pending or in progress at line 3 column 8. All of the jobs have been canceled or aborted and I still get the error message.
I have reached out to dev support and have had a case open for almost a month. I am now becoming very frustrated with the fact that nobody has been able to reach a solution. This wasn't a problem until we were updated to the latest version which is salesforce Winter 14. I was first told that this would fix the issue, it did not resolve the issue, I was then instructed to remove all scheduled jobs, I have removed all scheduled jobs and apex jobs. (This is our sandbox) This has also not resolved the issue. I have been waiting over a week for a phone call back from Dev support and have not received a single phone call when asked for an update. I am wanting to see if anyone has any other ideas or am I just stuck at the wims of Dev support?
This is my Scheduler that called a class that I could not edit and save: (I did not have any pending/scheduled jobs)
I attempted to edit this Scheduler but even IT couldn't be edited until I discovered where and what to edit.
This is my temporarily revised Scheduler:
I removed "implements Schedulable", changed the class name, removed the "SchedulableContext" type in the execute methods parameter and replaced it with a string, and then commented out the guts of the execute method. This made it so I could save this now schedule-less Scheduler which, in turn, allowed me to edit and save the class that I previously wasn't allowed to.
So, I made my changes to the other class, saved it, and simply reverted my Scheduler back to its previous state and was able to go about my day, support-free.
I have no idea if there are consequences to this approach, but it worked for getting past the error.
The schedule will not be statically linked to the actual implementation anymore. You will still get the error if you want to change "MyTaskJob", but there will be little to no reason to.
1) login to "https://workbench.developerforce.com/login.php" 2) On right corner, it will be showing your name and API version. Click on that link 3) There you will find change API version, change it to 32 4) Go to Utilities >> Apex Execute There run this command with job Id
I believe this would help you. Please let me know if you have any other questions, I would love to help you in that as well.
for aborting the apex jobs use the following query in Work bench.
------------------------------------------------------------------------------------------------------------------------------------
List<CronTrigger> jobsToBeAborted= [select Id from CronTrigger where CronJobDetail.JobType = '7']; for (CronTrigger job : jobsToBeAborted) { System.abortJob(job.Id); }
--------------------------------------------------------------------------------------------------------------------------------------------