Newer Version Available
FlexQueueItem
Represents an asynchronous Apex job in the Apex flex
queue. Provides information about the job type and flex queue position of the AsyncApexJob.
This object is available in API version 36.0 and later.
Supported Calls
describeSObjects(), query()
Fields
| Field Name | Description |
|---|---|
| AsyncApexJobId |
|
| FlexQueueItemId |
|
| JobPosition |
|
| JobType |
|
Usage
To find the position of an AsyncApexJob in the flex queue, query
JobPosition. For
example:
1SELECT JobPosition FROM FlexQueueItem WHERE JobType = 'BatchApex' AND AsyncApexJobId = '707xx000000DABC'
To find the job at a given position, query
AsyncApexJobId. For
example:
1SELECT AsyncApexJobId FROM FlexQueueItem WHERE JobType = 'BatchApex' AND JobPosition = '2'
To find all batch jobs in the flex queue, query JobType. To
get other information about the jobs, include AsyncApexJob in your query. For
example:
1SELECT JobType, JobPosition, AsyncApexJob.ApexClass.Name, AsyncApexJob.CreatedDate,
2 AsyncApexJob.CreatedBy FROM FlexQueueItem WHERE JobType='BatchApex' AND
3 AsyncApexJob.ApexClass.Name LIKE '%'BatchAJob'%' ORDER BY JobPosition DESC