Workflow process life cycle describes the state transitions from creation through execution. A process can be in one of the following states,
- Ready
- Suspended
- Locked
- Completed
The events that occur through out the lifetime of process cause a transition from one state to another.
State of asynchronous operations can be changed by the user. For example, an asynchronous operation that is in a suspended state can be restarted by the user.
The asynchronous service enables us to execute, monitor and manage various long running operations, such as bulk mail and workflow processes. To improve performance, scalability and reliability of MS Dynamics CRM, these operations are run asynchronously. This means that a requested operation is not processes instantly, but added to a queue and processed by CRM at an appropriate time. When an event is raised in the MS Dynamics CRM Platform pipeline, all workflows that are associated with the event are executed by the asynchronous service. The workflow event handlers are added to the asynchronous queue and processes according to the event execution order.
When certain conditions such as a restart or shut down occur when a workflow is running, the workflow runtime engine uses a persistence service to save the state of the workflow instance onto the disk. The persistence service is also invoked when other conditions occur, such as when a workflow becomes idle and is waiting for some external event to occur. Persisting these idle workflow instances saves memory and greatly increases scalability. If a server that is running the asynchronous service is shut down or if the workflow crashes during execution, the workflow can be restarted from its last persisted point after the server restarts. When the workflow is no longer idle, the state of the workflow instance is restored in memory to the state at the last persisted point.