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

Schedulable class is unschedulable
I have an unusual problem. I have developed an Apex class which implments schedulable. I go into Setup -> Develop -> Apex Classes -> Schedule Apex and fill in the form. Now, when I'm selecting the class I just press the icon to give me a list and it only returns the one class which implements schedulable, which would appear the smart way of letting you select the class.
However, I get the following error -
Error: You must select an Apex class that implements the Schedulable interface.
I'm really baffled by this, see code below.
global class TimesheetWeeklyJob implements Schedulable{
global void execute( SchedulableContext SC ) {
WeeklyTimesheetProcess.markSubmitted();
WeeklyTimesheetProcess.createNewSheets();
}
}
When did you receive this error? On save of the schedule? I can't seem to reproduce. Just curious, if you saved the class with a different name and tried to schedule it, what happens?
Yes, it was on the save that I received the error. I renamed the class to TimesheetWeeklyJob2 and it scheduled correctly. I then renamed it back to TimesheetWeeklyJob, and it also scheduled correctly. I now have a solution, although am somewhat more baffled than before.
I've seen something similar. My solution was to make the class inactive, then switch it back to active.
I think there might be a bug in the scheduling implementation somewhere...
We will try to repro at HQ. Let me know if you find a repro.
t
I'd found it to be very intermittent...
Yes, this is very odd.
I went to the help and Community forums looking for answers, found this thread, then went back to SFDC..
Lo-and-behold, after the passage of time (20 minutes) , the class had been marked as valid and could be found as a schedulable class in the 'Schedule Apex' user interface. There was no action I took either in deployment, the admin Setup options, or anything.
Without better information, it would appear that something in the background runs at SFDC cloud that re-enables schedulable classes after either their previous schedule is deleted and/or an intervening deployment of referenced classes has occurs.
// Niklas
Click on 'Apex Classes'
There's a link at the top left "Compile All Classes"
After I did the above (in a new browser tab), I was able to schedule my class.
Caution: Enabling this option may cause Apex jobs to fail.
so I unchecked it again and after that I was able to schedule my class through an schedule apex UI form.
Don't know if this is normall behaviour or a bug but it solved my problem
KKR.