My use case: Any time I update code that is related to a currently scheduled job, that job has to first be unscheduled, then rescheduled after the code update. Doing this manually is a pain!
My plan was to a create a couple utility methods in Apex: one that would delete all scheduled jobs using the CronTrigger object, and a second that would programmatically reschedule all jobs I have in my system.
The issue: That second method, which reschedules all jobs, is running into issues when it comes to hidden classes in managed packages. If there's a schedulable class in a managed package, I can use the scheduling UI to schedule the job, but apparently running a line of code like
system.schedule('Schedulable class in managed package', '0 0 22 ? * 1', new HiddenClass());
will throw an error:
Invalid type: HiddenClass
Question: Is my approach possible, given the hidden nature of classess in managed packages? Is there a better way to update apex that is related to scheduled jobs, without having to delete and reschedule those jobs using the UI each time?