---
schema_version: "1"
id: 0123c41958b7257c2da0680141165f925d5b006adc545d2bada3f3151a040165
title: AsyncApexJob
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_asyncapexjob.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_asyncapexjob.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8eaa9aa51425ee815d686bc4e417cec1a2d79dd333f5e4498651910976df85f1
description: Represents an individual Apex sharing recalculation job, a batch Apex job, a method with the future annotation, or a job that implements Queueable or Schedulable. Use this object to query Apex batch jobs in your organization.
---
# AsyncApexJob

Represents an individual Apex sharing recalculation job, a batch Apex job, a method with the future annotation, or a job that implements Queueable or Schedulable. Use this object to query Apex batch jobs in your organization.

## Supported Calls

describeSObjects(), query(), retrieve()

## Special Access Rules

If Apex isn’t running in system mode, users must have the View Setup and Configuration permission to access this object and to enqueue asynchronous Apex jobs.

## Fields

| Field Name | Details |
| --- | --- |
| ApexClassId | 
Type

reference

Properties

Filter, Group, Nillable, Sort

Description

The ID of the Apex class executing the job. Label is Class ID.

This is a relationship field.

Relationship Name

ApexClass

Relationship Type

Lookup

Refers To

ApexClass



 |
| CompletedDate | 

Type

dateTime

Properties

Filter, Nillable, Sort

Description

The date and time when the job was completed.



 |
| CronTriggerId | 

Type

reference

Properties

Filter, Group, Nillable, Sort

Description

The ID of the CronTrigger for the AsyncApexJob. This field only applies to ScheduledApex job type. This field is available in API version 53.0 and later. For scheduled jobs created before version 53.0, this field is populated on subsequent execution.

This is a relationship field.

Relationship Name

CronTrigger

Relationship Type

Lookup

Refers To

CronTrigger



 |
| ExtendedStatus | 

Type

string

Properties

Filter, Group, Nillable, Sort

Description

If one or more errors occurred during the batch processing, this field contains a short description of the first error. A more detailed description of that error, along with any subsequent errors, is emailed to the last user who modified the batch class. This field is available in API version 19.0 and later.



 |
| JobItemsProcessed | 

Type

int

Properties

Filter, Group, Sort

Description

Number of job items processed. Label is Batches Processed.



 |
| JobType | 

Type

picklist

Properties

Filter, Group, Restricted picklist, Sort

Description

The type of job being processed. Valid values are:

- ApexToken
- [BatchApex](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_batch_interface.htm)
- BatchApexWorker
- [Future](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_invoking_future_methods.htm)
- [Queueable](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_queueing_jobs.htm)
- [ScheduledApex](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_scheduler.htm)
- [SharingRecalculation](https://help.salesforce.com/s/articleView?id=platform.security_apex_sharing_recalc.htm&type=5&language=en_US)
- TestRequest
- TestWorker





 |
| LastProcessed | 

Type

string

Properties

Filter, Group, Nillable, Sort

Description

Last ID that was processed and committed.



 |
| LastProcessedOffset | 

Type

int

Properties

Filter, Group, Nillable, Sort

Description

Offset of the last ID that was processed and committed.



 |
| MethodName | 

Type

string

Properties

Filter, Group, Nillable, Sort

Description

The name of the Apex method being executed. Label is Apex Method.



 |
| NumberOfErrors | 

Type

int

Properties

Filter, Group, Nillable, Sort

Description

Total number of batches with a failure. A batch is considered transactional, so any unhandled exceptions constitute an entire failure of the batch. Label is Failures.



 |
| ParentJobId | 

Type

reference

Properties

Filter, Group, Nillable, Sort

Description

For batch Apex jobs that run using chunking implementation, multiple child jobs of type BatchApexWorker are created. Each of these child job records contains the job Id of the parent Apex job that started their execution. For batch Apex jobs that run using a non-chunking implementation, child jobs aren’t created.



 |
| Status | 

Type

picklist

Properties

Filter, Group, Restricted picklist, Sort

Description

The status of the job. Valid values are:

- Aborted
- Completed
- Failed
- Holding1
- Preparing
- Processing
- Queued

1 This status applies to batch jobs in the Apex flex queue.



 |
| TotalJobItems | 

Type

int

Properties

Filter, Group, Nillable, Sort

Description

Total number of batches processed. Each batch contains a set of records. Label is Total Batches.



 |

## Usage

Use this object to query Apex batch jobs in your organization.