Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Asynchronous Operation States

[Applies to: Microsoft Dynamics CRM 2011]

After asynchronous operations are added to the asynchronous queue, they exist in a well-defined state. An asynchronous operation can be waiting to run, it can be running, or it can be completed. There are also other possible states before the operation is eventually deleted from the queue. The states define the life cycle of the asynchronous operation.

In This Topic

States for Asynchronous Operations

The state of the asynchronous operation can be altered through three means: by the platform as part of regular queue processing, by the user interacting with the Microsoft Dynamics CRM Web application, or by a Web service call that alters the asynchronous operation. As a developer you can retrieve the current state of any asynchronous operation that you have access to and also change the state.

The following table lists the states, and the statuses for each state, of an AsyncOperation.


State Status Numeric status value

























For SDK programming, supported states are defined in the AsyncOperationState enumeration. In the early bound AsyncOperation class, the state is available in the AsyncOperation.StateCode attribute while the status is available in the AsyncOperation.StatusCode attribute. For more information, see AsyncOperation (System Job) Entity OptionSet Attribute Metadata. The statuses are shown in the Microsoft Dynamics CRM Web application in the Status Reason field in System Jobs grid. By selecting any of the menu items in the More Actions menu in System Jobs, you can interactively alter the state of an asynchronous operation. Allowed actions include the following: Cancel, Resume, Postpone, and Pause.

The following diagram shows the asynchronous operation state transitions that are supported.

AsyncOperation state diagram

Notice that an asynchronous operation can only transition from one state to another along specific paths as shown in the diagram. Some paths are initiated by the user interacting with the Microsoft Dynamics CRM Web application while other paths are initiated by the Microsoft Dynamics CRM platform as part of regular asynchronous queue processing or because of a Web service call. For example, an asynchronous operation cannot transition directly from a Suspended state to a Locked state.

A locked state indicates that the AsyncOperation instance is being used by the asynchronous service. While it is locked it cannot be used by another instance of the service. This ensures that the instance is not executed more than once, for example by two different asynchronous services.

Retrieving and Updating AsyncOperation States

Monitoring and updating the state of an asynchronous operation is typically done interactively through the System Jobs grid in the Microsoft Dynamics CRM Web application. However, you can also use the SDK to write code that performs those same tasks.

Read the state of an asynchronous operation

  1. Retrieve an AsyncOperation by name using the RetrieveMultiple method or by ID using the Retrieve method.

  2. Read the AsyncOperation.StateCode attribute.

Change the state code

  1. Modify the retrieved state code attribute to a new value according to the allowed operation states. You could also change the AsyncOperation.PostponeUntil attribute.

  2. Call Update to change the value of those attributes in the database.

The previous operations can also be performed by using the Execute method with the appropriate request messages. Attributes of AsyncOperation other than AsyncOperation.StateCode and AsyncOperation.PostponeUntil should be considered read-only.

Recurring System Jobs

You cannot cancel, pause, or resume most system jobs. Refer to the following list that identifies some of these restricted system jobs. The value in the first column is the value of the OperationType attribute of the AsyncOperation entity.


Async Operation Type (Option Value) Operation Description


Calculate Organization Maximum Storage Size


Calculate Organization Storage Size


Collect Organization Database Statistics


Collection Organization Size Statistics


Collect Organization Statistics


SQM Data Collection


Organization Full Text Catalog Index


Storage Limit Notification


Update Statistic Intervals


Update Contract States

For the complete list of supported asynchronous operation types, see AsyncOperation (System Job) Entity OptionSet Attribute Metadata.

See Also

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.