Life cycle

Life cycle


1. Create/Initialized

1. Creating a process starts with calling CreateInstance and specifying the code of scheme and generation parameters.

The engine then looks for an existing schema with specified parameters. If there is a similar but obsolete scheme, or if the scheme does not exist, the core then creates a new process scheme with the help of IWorkflowGenerator.

Once the scheme is created, the following records are added to the tables: 

  • WorkflowProcessInstance - main parameters of the process, such as current state, previous state etc.
  • WorkflowProcessInstancePersistence - user defined parameters of the process marked as "Persisted".
  • WorkflowProcessInstanceStatus - information about process execution status.

2. The process status is marked as Initialized.

3. Actions from the “Implementation” section are executed consistently.

4. The process status is marked as Idle.

 

2. Idle

Wait state.

 

3. Pre-Execution

A special mode to ensure a consistent transition through all document statuses, while executing Actions from the “Pre-Execute Implemetation” block. The mode is used to create the next stages of the document.

To initialize the mode, call PreExecute (PreExecuteFromCurrentActivity/PreExecuteFromInitialActivity).

The process status remains unchanged.

 

4. Execute/Running

A mode to execute either a transition upon command, or a timed or automatic transition.

Continuity:

  1. Check for the user access to the operation.
  2. Check for the state of the document (execution continues if the status is “Idle”).
  3. Transition into the next Activity, updating process parameters in WorkflowProcessInstance and creating a record in WorkflowProcessTransitionHistory.
  4. Consistent execution of all Actions from the “Implementation” block.
  5. Setting the status to “Idle”.

 

5. Set State

Setting the state is only available in the Activities marked as “Set state.” To call, use SetState.

The process status remains unchanged.

 

6. Updating scheme

The document moves to this stage if its scheme is marked as “IsObsolete.” In this case, the system updates the scheme of the process.

An automatic update of the process scheme is only possible in Activity marked as “Auto scheme update.”

The process status remains unchanged.

 

7. Terminated

The document moves to this stage in case there are process errors happening during the event.

In WorkflowProcessInstanceStatus the document receives the status “Terminated.”

 

8. Finalized

The document moves to this stage, only after it reached the Activity marked as “Final” or Activity without any outgoing Transitions.

In WorkflowProcessInstanceStatus, the document receives the status “Finalized.”