+ Start a Discussion
Alec EvansAlec Evans 

Unable to Schedule Apex Classes

I'm trying to schedule a couple of Apex Classes to run weekly.

When I attempt this in our "Sandbox" environment I can go to Develop > Apex Classes > Schedule Apex and the available Apex Classes appear but when I try this in the "Live" environment no Apex Classes are available to schedule (they appear in the Apex Classes section but do not appear in the Schedule Apex section)

The message returned says
No records found due to one of the following:
  • There are no records of this type
  • You don't have permission to see any of the records

I have admin rights and I've tried to schedule them using our other admin users login details but with no luck.

Is this a problem with my access rights (and how do get the necessary access rights) or is there something obvious that I'm missing?

Many thanks

Alec
Jerome LusinchiJerome Lusinchi
Hi Alec,

Try to run all test classes and then try again to schedule.
No sure it will work, but i had the same problem once and it fixed it.

Regards,
Jerome
Robert RichterRobert Richter
There is a limit of scheduled jobs that can be run (I think the limit is 25 jobs). May you have exceeded the limit? 
Alec EvansAlec Evans
Thanks Jerome / Robert

Jerome - Ran the tests and all pass but still unable to select them in the scheduler
Robert - There are 7 jobs running in the Admin Setup > Monitoring > Scheduled Jobs
 
Jerome LusinchiJerome Lusinchi
Have you tried to schedule it with the developer console ?
Alec EvansAlec Evans
I haven't...  I've been trying to find (via google) the code I'd need to use in the developer console but without luck.

Any help would be gratefully recieved if anybody could help point me in the right direction.

The two Apex Classes are
  • LinksUpdateBatch
  • TableUpdateBatch
I'd like them both to run weekly on Sunday evening or Monday morning

Many Thanks
Jerome LusinchiJerome Lusinchi
Hi Alec,

here is the documentation :
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm

here is the exemple code :

scheduledMerge m = new scheduledMerge();
String sch = '20 30 8 10 2 ?';
String jobID = system.schedule('Merge Job', sch, m);

replace "scheduledMerge" by your schedulable class.

and here is the format of the "sch" string : 

Seconds    Minutes    Hours    Day_of_month    Month Day_of_week    optional_year

Regards,
Jerome
Alec EvansAlec Evans
Thanks Jerome, really appreciate the help.

Tried to schedule via the developer console to run at 4am each morrning but returns an error saying that "managed installed classes cannot be saved."

Screen dump of Developer Console
Leo SantillanLeo Santillan
You have to go to Develop-> Apex Classes and click on Compile all classes, then click on Schedule Apex and you will be able to schedule the job.
Prasanth M AbrahamPrasanth M Abraham
Compiling all Classes helped here. Would like to understand compile all class functionality - when is this supposed to be used?
bhawna ramchandanibhawna ramchandani
Hello I have compiled all the classes but stil not able to find apex classes for schdule.
carmilyn.c martincarmilyn.c martin
Check security of your Batch and Schedule Apex. Make sure that the Standard Salesforce Admin profile is added. Same goes to the batch job that you created. I think we have the same problem.