Skip to main content

SF-0389 · Concept · Medium

What will be the status of the job in the apex flex queue?

✓ Verified by Vikas Singhal · Last reviewed 5/17/2026 · Updated for Spring '26

A batch job sitting in the Apex Flex Queue has status Holding. As soon as a Processing slot opens up (one of the 5 active jobs completes), the front-of-queue Holding job is promoted to QueuedPreparingProcessing.

The full status lifecycle of a Batch Apex job

Holding  →  Queued  →  Preparing  →  Processing  →  Completed
                                                  →  Failed
                                                  →  Aborted
StatusWhere it’s at
HoldingIn the Flex Queue, waiting for an active slot
QueuedPicked up from the Flex Queue, waiting to start
Preparingstart method running (building QueryLocator / Iterable)
ProcessingOne or more execute chunks running
CompletedAll chunks done, finish ran
FailedHit an uncaught exception or limit
AbortedCancelled by System.abortJob or UI

Holding is unique to batch jobs in the Flex Queue. Queueable and Future jobs don’t have a Holding state — they go straight to Queued.

Spot Holding jobs

SELECT Id, ApexClass.Name, Status, CreatedDate
FROM AsyncApexJob
WHERE Status = 'Holding' AND JobType = 'BatchApex'
ORDER BY CreatedDate ASC

The first one in the result set is the next to be promoted.

The UI view

Setup → Apex Flex Queue lists only Holding jobs. The list is ordered by queue position, which is initially the order submitted but can be changed via:

  • The Reorder buttons in the UI
  • FlexQueue.moveJobToFront(jobId) (and friends) in Apex

Setup → Apex Jobs shows everything regardless of status.

What Holding means for monitoring

When a user submits a long-running batch, you may want to differentiate “your job is waiting” from “your job is running” in the UI:

public static String userFriendlyStatus(Id jobId) {
    AsyncApexJob job = [SELECT Status FROM AsyncApexJob WHERE Id = :jobId];
    if (job.Status == 'Holding') return 'Waiting in queue';
    if (job.Status == 'Preparing' || job.Status == 'Processing') return 'Running';
    if (job.Status == 'Completed') return 'Complete';
    if (job.Status == 'Failed' || job.Status == 'Aborted') return 'Stopped';
    return job.Status;
}

What you can do to a Holding job

ActionWorks on Holding job?
Abort (System.abortJob)Yes
ReorderYes
Move to frontYes
Read detailsYes

What you can’t do on a Holding job: see chunk progress (none yet), see error messages (none yet), see TotalJobItems (calculated in Preparing).

Common interview follow-ups

  • Is Holding ever used outside batch? — No — only batch jobs in the Flex Queue.
  • Why isn’t Holding documented for Queueable? — Queueable doesn’t use the Flex Queue. Its concurrency is governed by the daily async limit.
  • How long can a job stay in Holding? — As long as the queue is busy. Could be seconds, minutes, or never (if you’ve truly exceeded capacity continuously).

Verified against: Apex Developer Guide — Monitoring Asynchronous Apex. Last reviewed 2026-05-17.