---
schema_version: "1"
id: 260a8b37777ce4b6434d95fcef9f9c4b07460c744efccbee7d966164d8016f29
title: AsyncResult
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_asyncresult.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_asyncresult.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2730735a7070c66e0931d8628a1157e8fd6c667971f84484f8ed74766f3db47d
description: Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.
---
# AsyncResult

Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.

## API Version 31.0 and Later

In API version 31.0, the process of retrieving metadata has been simplified and retrieval properties have been moved to [RetrieveResult](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_retrieveresult.htm "The retrieve() call returns an array of RetrieveResult objects."). Also, the asynchronous [create()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_create.htm#meta_create "Deprecated. Adds one or more new metadata components to your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use createMetadata() instead."), [update()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_update.htm#meta_update "Deprecated. Updates one or more components in your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use updateMetadata() or renameMetadata() instead."), and [delete()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_delete.htm#meta_delete "Deprecated. Deletes one or more components from your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use deleteMetadata() instead.") calls have been removed. Therefore, only the id field in AsyncResult is used. The id field is the ID of a deployment or retrieval.

These asynchronous calls can return AsyncResult.

- [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.")
- [retrieve()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_retrieve.htm "The retrieve() call retrieves XML file representations of components in an organization.")

AsyncResult has this field that’s in use.

### id

- **Type**: ID
- **Description**: Required. The ID of the component that's being deployed or retrieved.

All fields in AsyncResult other than id are deprecated as of API version 31.0. These fields exist but are no longer in use.

- done
- message
- state
- statusCode

## API Versions 29.0 and 30.0

In API version 29.0, Salesforce moved several properties from the AsyncResult object to the [DeployResult](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deployresult.htm "Contains information about the success or failure of the associated deploy() call.") object and added several new ones, to improve the process for getting information about deployments. For more information about these changes, see [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.").

In API versions 29.0 and 30.0, AsyncResult is returned by the same asynchronous calls as in API version 28.0 and earlier, but it has different fields.

### done

- **Type**: boolean
- **Description**: Required. Indicates whether the call has been completed (true) or not (false).

### id

- **Type**: ID
- **Description**: Required. The ID of the component that's being created, updated, deleted, deployed, or retrieved.

### message

- **Type**: string
- **Description**: The message that corresponds to the returned [statusCode](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") field, if any.

### state

- **Type**: AsyncRequestState ([enumeration](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title) of type string)
- **Description**: Required. The AsyncRequestState object has one of four possible values.
    - Queued: This call hasn’t started. It’s waiting in a queue.
    - InProgress: This call has started but hasn’t been completed.
    - Completed: This call has been completed.
    - Error: An error occurred. See the [statusCode](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") for more information.

### statusCode

- **Type**: StatusCode ([enumeration](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title) of type string)
- **Description**: If an error occurred during the [create()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_create.htm "Deprecated. Adds one or more new metadata components to your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use createMetadata() instead."), [update()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_update.htm "Deprecated. Updates one or more components in your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use updateMetadata() or renameMetadata() instead."), or [delete()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_delete.htm "Deprecated. Deletes one or more components from your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use deleteMetadata() instead.") call, a status code is returned, and the message that corresponds to the status code is returned in the [message](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") field. For a description of each StatusCode value, see [StatusCode](https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/sforce_api_calls_concepts_core_data_objects.htm#statuscode_topic) in the [SOAP API Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/ "HTML (New Window)").

## API Version 28.0 and Earlier

In API version 28.0 and earlier, these asynchronous calls can return AsyncResult.

- [create()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_create.htm "Deprecated. Adds one or more new metadata components to your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use createMetadata() instead.")
- [delete()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_delete.htm "Deprecated. Deletes one or more components from your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use deleteMetadata() instead.")
- [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.")
- [retrieve()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_retrieve.htm "The retrieve() call retrieves XML file representations of components in an organization.")
- [update()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_update.htm "Deprecated. Updates one or more components in your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use updateMetadata() or renameMetadata() instead.")

Use the [checkStatus()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_checkstatus.htm "Deprecated. Checks the status of asynchronous metadata calls create(), update(), or delete(), or the declarative metadata call retrieve(). This call is removed as of API version 31.0 and is available only in earlier versions.") call against each object to discover when the call is completed for that object. Salesforce updates each AsyncResult object as the call is completed or when errors occur.

Similarly, the [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") and [retrieve()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_retrieve.htm "The retrieve() call retrieves XML file representations of components in an organization.") calls use AsyncResult, though you must subsequently use [checkDeployStatus()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_checkdeploystatus.htm "Checks the status of declarative metadata call deploy().") or [checkRetrieveStatus()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_checkretrievestatus.htm "Checks the status of the declarative metadata call checkRetrieveStatus() and returns the zip file contents.") respectively to get more status information for the deployment or retrieval.

AsyncResult has the following fields.

### checkOnly

- **Type**: boolean
- **Description**: This field is available in API version 16.0 and later and is relevant only for the Indicates whether this deployment is used to check the validity of the deployed files without changing the organization (true) or not (false). A check-only deployment doesn’t deploy any components or change the organization in any way. [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") call.

### done

- **Type**: boolean
- **Description**: Required. Indicates whether the call has been completed (true) or not (false).

### id

- **Type**: ID
- **Description**: Required. The ID of the component that's being created, updated, deleted, deployed, or retrieved.

### message

- **Type**: string
- **Description**: The message that corresponds to the returned [statusCode](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") field, if any.

### numberComponentErrors

- **Type**: int
- **Description**: This field is available in API version 16.0 and later and is relevant only for the The number of components that generated errors during this deployment. [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") call.

### numberComponentsDeployed

- **Type**: int
- **Description**: This field is available in API version 16.0 and later and is relevant only for the The number of components that have been deployed for this deployment. This field in conjunction with the [numberComponentsTotal](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") field gives you an indication of the progress of the deployment. [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") call.

### numberComponentsTotal

- **Type**: int
- **Description**: This field is available in API version 16.0 and later and is relevant only for the The total number of components in the deployment. This field in conjunction with the [numberComponentsDeployed](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") field gives you an indication of the progress of the deployment. [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") call.

### numberTestErrors

- **Type**: int
- **Description**: This field is available in API version 16.0 and later and is relevant only for the The number of Apex tests that generated errors during this deployment. [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") call.

### numberTestsCompleted

- **Type**: int
- **Description**: This field is available in API version 16.0 and later and is relevant only for the The number of Apex tests that have been completed for this deployment. This field in conjunction with the [numberTestsTotal](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") field gives you an indication of the progress of tests for the deployment. [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") call.

### numberTestsTotal

- **Type**: int
- **Description**: This field is available in API version 16.0 and later and is relevant only for the The total number of Apex tests in the deployment. This field in conjunction with the [numberTestsCompleted](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") field gives you an indication of the progress of tests for the deployment. The value in this field isn’t accurate until the deployment has started running tests for the components that are being deployed. [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") call.

### secondsToWait

- **Type**: int
- **Description**: This field is no longer supported for API version 13.0 and later and is provided only for backward compatibility. The field was removed in API version 17.0. Indicates the number of seconds before the call is likely to be completed. This number is an estimate only. A reasonable approach is to wait one second before calling to see if the operation is complete. Double your wait time for each successive iteration of calls until the operation is complete.

### state

- **Type**: AsyncRequestState ([enumeration](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title) of type string)
- **Description**: Required. The AsyncRequestState object has one of four possible values.
    - Queued: This call hasn’t started. It’s waiting in a queue.
    - InProgress: This call has started but hasn’t been completed.
    - Completed: This call has been completed.
    - Error: An error occurred. See the [statusCode](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") for more information.

### stateDetail

- **Type**: string
- **Description**: Indicates which component is being deployed or which Apex test class is running. This field is available in API version 16.0 and later and is relevant only for the [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") call.

### stateDetailLastModifiedDate

- **Type**: dateTime
- **Description**: The date and time when the This field is available in API version 16.0 and later and is relevant only for the [stateDetail](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") field was last modified. [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") call.

### statusCode

- **Type**: StatusCode ([enumeration](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title) of type string)
- **Description**: If an error occurred during the [create()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_create.htm "Deprecated. Adds one or more new metadata components to your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use createMetadata() instead."), [update()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_update.htm "Deprecated. Updates one or more components in your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use updateMetadata() or renameMetadata() instead."), [delete()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_delete.htm "Deprecated. Deletes one or more components from your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use deleteMetadata() instead."), or [deploy()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm "Uses file representations of components to create, update, or delete those components in a Salesforce org.") call, a status code is returned, and the message that corresponds to the status code is returned in the [message](#meta_asyncresult "Contains the ID of a deployment or retrieval. In API version 28.0 and earlier, contains status information of any asynchronous metadata call.") field. For a description of each StatusCode value, see [StatusCode](https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/sforce_api_calls_concepts_core_data_objects.htm#statuscode_topic) in the [SOAP API Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/ "HTML (New Window)").