+ Start a Discussion

Prevention of deployment of code used by scheduled jobs - a bug?

I am wondering if anyone has come across this before.  When deploying code that is used by a Schedulable class, the platform prevents you from deploying the code if the code in question is anywhere in the dependency tree of the schedulable class.  Today I tried to deploy some code that would be two levels down from a schedulable class that I have and was prevented form doing so.  The problem is, the schedulable class that used it was not actually scheduled...another class was scheduled, but that class did not use this code at all. 


Once I deleted that scheduled job that did not use the code in question (there is no way to edit a scheduled job, since the screen only has a Delete button and a Cancel button AND it seems to me that there should be an Active checkbox that allows you to disable the job without deleting it, but I am starting to rant here...), I was allowed to deploy the code.


Is this a bug?


Notwithstanding the above situation, it seems to me that if code is more than one level away from the Schedulable class, and the jobs is not currently running, you should be able to deploy your code without having to delete the job.

Cory CowgillCory Cowgill



I experience the pain that is cancelling / deploying scheduled jobs all the time.


I *think this is per design.


SFDC does not want you to deploy an Apex Class that is a dependency on a scheduled job because it could cause runtime exceptions. 


I agree totally about disable scheduled apex. When you get into complex SFDC orgs there can be multiple scheduled apex jobs. If you use a Constants Apex Class to hold literals as needed, and its referenced in all the scheduled apex, you have to cancel, deploy, and reschdule. Very time consuming and painful.


So sorry I don't have an answer for you. This is more of a "I feel your pain" post. ;)