4

After the upgrade of salesforce to Spring 15, I am getting this error "Error: You have exceeded the maximum number (5) of Apex scheduled jobs." when scheduling more than 5 batches. I have this issue in several environment. I used to more than 20 batches scheduled at once. Schedule job error

On the link below, it says that I can schedule up to 100 batches but I am being restricted to 5 only. http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm

I can't have more than 5 jobs here. enter image description here

3
  • Confirming that I see this as well in Dev Orgs only. Even worse, it shows up if you have 5 batches scheduled and you make an @future call, which is breaking some of my code...
    – user17217
    Feb 18, 2015 at 17:39
  • There have some answers been posted here: salesforce.stackexchange.com/questions/66607/… Feb 19, 2015 at 9:21
  • I have got salesforce support technician who are working on the case.
    – Kevan
    Feb 19, 2015 at 11:32

2 Answers 2

2

Now, this issue is listed as known issue by Salesforce: https://success.salesforce.com/issues_view?id=a1p300000008Y2RAAU

Spring 15 -max number of APEX Scheduled jobs(5) for Trial orgs

Last updated Today ·Reference W-2509563 ·Reported By 9 users IN REVIEW

Summary: Max number of Apex scheduled jobs is limited to 5 in trial Orgs. Previously, it was 100.

Repro

Create 5 Scheduled jobs in a trial ORG Try to create another Scheduled job on top of the existing jobs. An error will be received as follows:

ERROR:

You have exceeded the max number of APEX Scheduled jobs(5)

Workaround: N/A

1

You are confusing Apex scheduler limits with concurrent batch job limits. As per the documentation:

Maximum number of Apex classes scheduled concurrently - 100
Maximum number of Batch Apex jobs queued or active concurrently - 5

You can run 100 scheduled classes concurrently, but if they instantiating a batch job they should always check if there is a free slot available.

With Apex Flex Queue, you can now schedule 100 batch jobs to run but they have to be in the status of "Holding".

Maximum number of Batch Apex jobs in the Apex flex queue that are in Holding status - 100

More information about Flex queue.

So, in your case when you are running the scheduled jobs, they seem to be running concurrently and instantiating batch jobs without checking if there are free slots available.

1
  • 1
    The number of Apex classes scheduled concurrently is 100, but in my case, I'm getting stuck at only 5. Even with the code below I'm getting the error when try to schedule the sixth one. global with sharing class SchedTest implements Schedulable{ global void execute(SchedulableContext sc) { System.debug ('SchedTest date:' +DateTime.now()); } }
    – Kevan
    Feb 18, 2015 at 5:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .