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. Also, the asynchronous create(), update(), and delete() 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.

AsyncResult has this field that’s in use.

Name Type Description
id ID 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 object and added several new ones, to improve the process for getting information about deployments. For more information about these changes, see deploy().

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.

Name Type Description
done boolean Required. Indicates whether the call has been completed (true) or not (false).
id ID Required. The ID of the component that's being created, updated, deleted, deployed, or retrieved.
message string The message that corresponds to the returned statusCode field, if any.
state AsyncRequestState (enumeration of type string) 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 for more information.
statusCode StatusCode (enumeration of type string) If an error occurred during the create(), update(), or delete() call, a status code is returned, and the message that corresponds to the status code is returned in the message field.

For a description of each StatusCode value, see StatusCode in the SOAP API Developer Guide.

API Version 28.0 and Earlier

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

Use the checkStatus() 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() and retrieve() calls use AsyncResult, though you must subsequently use checkDeployStatus() or checkRetrieveStatus() respectively to get more status information for the deployment or retrieval.

AsyncResult has the following fields.

Name Type Description
checkOnly boolean 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. This field is available in API version 16.0 and later and is relevant only for the deploy() call.
done boolean Required. Indicates whether the call has been completed (true) or not (false).
id ID Required. The ID of the component that's being created, updated, deleted, deployed, or retrieved.
message string The message that corresponds to the returned statusCode field, if any.
numberComponentErrors int The number of components that generated errors during this deployment. This field is available in API version 16.0 and later and is relevant only for the deploy() call.
numberComponentsDeployed int The number of components that have been deployed for this deployment. This field in conjunction with the numberComponentsTotal field gives you an indication of the progress of the deployment. This field is available in API version 16.0 and later and is relevant only for the deploy() call.
numberComponentsTotal int The total number of components in the deployment. This field in conjunction with the numberComponentsDeployed field gives you an indication of the progress of the deployment. This field is available in API version 16.0 and later and is relevant only for the deploy() call.
numberTestErrors int The number of Apex tests that generated errors during this deployment. This field is available in API version 16.0 and later and is relevant only for the deploy() call.
numberTestsCompleted int The number of Apex tests that have been completed for this deployment. This field in conjunction with the numberTestsTotal field gives you an indication of the progress of tests for the deployment. This field is available in API version 16.0 and later and is relevant only for the deploy() call.
numberTestsTotal int The total number of Apex tests in the deployment. This field in conjunction with the numberTestsCompleted 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. This field is available in API version 16.0 and later and is relevant only for the deploy() call.
secondsToWait int 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 AsyncRequestState (enumeration of type string) 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 for more information.
stateDetail string 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() call.
stateDetailLastModifiedDate dateTime The date and time when the stateDetail field was last modified. This field is available in API version 16.0 and later and is relevant only for the deploy() call.
statusCode StatusCode (enumeration of type string) If an error occurred during the create(), update(), delete(), or deploy() call, a status code is returned, and the message that corresponds to the status code is returned in the message field.

For a description of each StatusCode value, see StatusCode in the SOAP API Developer Guide.