This documentation is archived and is not being maintained.

Operation States

Forefront
banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

After asynchronous operations are created in 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.

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.

StateStatusNumeric status value
ReadyWaitingForResources0
SuspendedWaiting10
LockedInProgress20
LockedPausing21
LockedCanceling22
CompletedSucceeded30
CompletedFailed31
CompletedCanceled32

For SDK programming, supported states are defined in the AsyncOperationState enumeration while the statuses are defined in the AsyncOperationStatus static class. In the asyncoperation class, the state is available in the statecode property while the status is available in the statuscode property. The statuses are shown in the Microsoft Dynamics CRM Web application in the Status Reason column in System Jobs. 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.

Asynchronous operation 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 an instance of the asynchronous service. While it is locked it cannot be used by another instance of the service. This ensures that the asyncoperation instance is not executed more than once, for example by two different asynchronous services.

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show: