related to: https://developer.salesforce.com/releases/release/Spring15/FlexQueue and https://help.salesforce.com/apex/HTViewHelpDoc?id=code_apex_flex_queue.htm&language=en_US

In both linked pages, the documentation says "The Apex flex queue enables you to submit up to 100 batch jobs for execution". I'm tempted to tell each of my users that 'you' can submit 100 batches, but that might not be what SFDC meant.

I'm looking for confirmation that this per-Org, rather than something more granular and generous like per execution context.

Related to that, if I have several hundred users, and a UI with a button that says "submit batch", is the normal path for the code to query the queue, and reject the submission if there are already 100 pending batches?

1 Answer 1


You can still only have 5 concurrent batch process running at one time. Salesforce (with the FlexQueue) have introduced a new status Holding, such that you can have (per org) a maximum of 100 jobs in Holding, and a maximum of 5 either Queued, Preparing (but not Holding) or Processing.

From the docs

Holding Batch Jobs in the Apex Flex Queue With Apex Flex Queue, you can submit up to 100 batch jobs without getting an error.

The outcome of Database.executeBatch is as follows.

  • The batch job is placed in the Apex flex queue, and its status is set to Holding.
  • If the Apex flex queue has the maximum number of 100 jobs, Database.executeBatch throws a LimitException and doesn’t add the job to the queue.

When system resources become available, the system picks up the next job from the top of the Apex flex queue and moves it to the batch job queue. The system can process up to five queued or active jobs simultaneously for each organization. The status of these moved jobs changes from Holding to Queued. Queued jobs get executed when the system is ready to process new jobs. You can monitor queued jobs in the Apex Jobs page.

So, if you did flood the queue with multiple requests, you'd get a Limits exception, so its still worth checking the number of jobs prior to doing that.

  • Thanks for the info. I was hoping for something that expressed your parenthetical (per org) more explicitly. If that's as direct as the documentation gets, I'll accept it.
    – SeanW
    Jul 22, 2015 at 19:01
  • Documentation never seems to mention per org and batch apex limits on the same page, but it is per org. More info here too na1.salesforce.com/help/pdfs/en/… Jul 22, 2015 at 19:38
  • 2
    Thanks, that's a very helpful link. ...52 pages for a "quick reference" guide?!
    – SeanW
    Jul 23, 2015 at 16:38

You must log in to answer this question.

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