States and Transitions
Learn about states and transitions for workflows and for workflow activities.
Workflow States and Transitions
Learn about available workflow states and potential transitions.
Workflow States
A workflow state is the current state of a workflow instance. There are five separate workflow states, and a workflow may only be in one state at a time.
Active
A workflow that is currently running.
Suspended
A workflow that is currently suspended at a particular activity. A suspended workflow can be resumed by the Workflow Administrator.
Completed
A workflow that has reached an end activity and completed successfully.
Terminated
A workflow that has been stopped by the Workflow Owner or Workflow Administrator or a workflow that has reached an end activity with the state attribute set to terminated.
Faulted
A workflow that produced an error at one of its activities. The Workflow Administrator can retry or stop a faulted workflow.
Workflow State Transitions
A workflow transition describes a workflow moving from one state to another. Workflow state transitions happen either by the workflow engine itself, by appropriate APIs, or as a result of a user action. For example, a workflow may transition from Active to Completed after a user approves a task.
| Initial State | Category | Possible Transitions |
|---|---|---|
| Active | Normal |
|
| Completed | Normal | None. |
| Faulted | Exception <div class="infobox-tip" id="GUID-BB295C48-64CA-4291-8365-AF80D725344F__GUID-C0AAB232-EE20-4555-AFE0-0827AC677569"> <p class="notep1">Tip:</p>Workflows transition to faulted if an activity cannot run successfully or if there is an error in the workflow itself due to a failure to retrieve workflow variables or a system error.<p>Faulted workflows can be retried after modifying variables, or terminated if the user wants to end the workflow instance and no longer run the workflow.</p></div> |
|
| Suspended | Normal <div class="infobox-tip" id="GUID-BB295C48-64CA-4291-8365-AF80D725344F__GUID-9201252A-3C5A-42BD-8344-7CBDC2DB4743"> <p class="notep1">Tip:</p>Typically, a workflow is suspended due to a Wait activity. </div> <div class="infobox-tip" id="GUID-BB295C48-64CA-4291-8365-AF80D725344F__GUID-1D7DFC2A-90AD-4F3B-B614-48CB536CF065"> <p class="notep1">Tip:</p>By default, workflows resume at the current activity. Use APEX_WORKFLOW.RESUME to resume the workflow at any activity. </div> |
|
| Terminated | Exception <div class="infobox-tip" id="GUID-BB295C48-64CA-4291-8365-AF80D725344F__GUID-B082D3C7-18A2-4353-B53B-921E5F396EA2"> <p class="notep1">Tip:</p>A terminated workflow instance cannot be retried. </div> | None. |
Activity States and Transitions
Learn about available activity states and potential transitions.
Activity States
An activity state is the current state of an activity. An activity can only be in one state at a time.
Active
An activity that is currently running.
Waiting
An activity that is currently waiting for a result. For example, an activity might be waiting on approval from a task, waiting for an invoked workflow to run, or waiting for all branches in the activity to complete.
Completed
An activity that completed successfully.
Tip: For parallel flow activities, all branches in the parallel flow must complete for the activity to transition to Completed.
Terminated
An activity that was in active state when the workflow was stopped.
Faulted
An activity that fails to run.
Tip: If an activity in a branch of a parallel flow activity transitions to the faulted state, the parallel flow activity also transitions to faulted. Retrying the workflow retries all faulted activities in all branches of the parallel flow activity. It may be necessary to retry the workflow multiple times until all faults in all branches are fixed.
Activity State Transitions
An activity transition describes an activity moving from one state to another.
| Initial State | Category | Possible Transitions |
|---|---|---|
| Active | Normal |
|
| Completed | Normal | None. |
| Faulted | Exception |
|
| Terminated | Exception | None. |
| Waiting | Normal |
|