Newer Version Available

This content describes an older version of this product. View Latest

AsyncResult

Poll the values in this object to determine when an asynchronous metadata call has completed, and whether it was successful or not.

The asynchronous metadata calls create(), update(), and delete() return an array of AsyncResult objects. Each element in the array corresponds to an element in the array of metadata components passed in the call.

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 completes, or when any errors occur.

The retrieve() call uses AsyncResult similarly, though you must subsequently use checkDeployStatus() or checkRetrieveStatus() respectively to get more status information for the deployment or retrieval.

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().

For API versions 29.0 and later, the AsyncResult object has the following properties.

Name Type Description
done boolean Required. Indicates whether the call has completed (true) or not (false).
id ID Required. ID of the component being created, updated, deleted, deployed, or retrieved.
message string Message corresponding to the statusCode field returned, if any.
state AsyncRequestState (enumeration of type string) Required. The AsyncRequestState object has one of four possible values:
  • Queued: This call has not started. It is waiting in a queue.
  • InProgress: This call has started, but has not completed yet.
  • Completed: This call has 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 corresponding to the status code is returned in the message field.

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

For API versions 28.0 and earlier, the AsyncResult object has the following properties.

Name Type Description
checkOnly boolean Indicates whether this deployment is being used to check the validity of the deployed files without making any changes in the organization (true) or not (false). A check-only deployment does not deploy any components or change the organization in any way. This field is available in API version 16.0 and later and is only relevant for the deploy() call.
done boolean Required. Indicates whether the call has completed (true) or not (false).
id ID Required. ID of the component being created, updated, deleted, deployed, or retrieved.
message string Message corresponding to the statusCode field returned, 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 only relevant for the deploy() call.
numberComponentsDeployed int The number of components that have been deployed so far 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 only relevant 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 only relevant for the deploy() call.
numberTestErrors int The number of Apex tests that have generated errors during this deployment. This field is available in API version 16.0 and later and is only relevant for the deploy() call.
numberTestsCompleted int The number of Apex tests that have completed so far 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 only relevant 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 is not accurate until the deployment has started running tests for the components being deployed. This field is available in API version 16.0 and later and is only relevant for the deploy() call.
secondsToWait int This field is no longer supported for API version 13.0 and later and is only provided for backward compatibility. The field was removed in API version 17.0.

Indicates the number of seconds before the call is likely to complete. This is an estimate only. A reasonable approach is to wait one second before calling checkStatus() to see if the operation is complete. Double your wait time for each successive iteration of checkStatus() 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 has not started. It is waiting in a queue.
  • InProgress: This call has started, but has not completed yet.
  • Completed: This call has completed.
  • Error: An error occurred. See the statusCode for more information.
stateDetail string Indicates which component is currently being deployed or which Apex test class is running. This field is available in API version 16.0 and later and is only relevant for the deploy() call.
stateDetailLastModifiedDate dateTime The data and time when the stateDetail field was last modified. This field is available in API version 16.0 and later and is only relevant 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 corresponding to the status code is returned in the message field.

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