Jumping to Different Activities in a Workflow
Introduction
Running workflow instances can be manually changed while they are in progress. This means that you can manually select what activity the workflow will continue from. This can be useful to correct wrong decisions or to continue a workflow when it is in incompatible state. You can use the Generate Jump-to Option microflow action to generate a list of activities the workflow can jump to and the Apply Jump-To Option microflow action to apply the desired changes to the workflow instance. The information is captured in a set of non-persistable entities.
Related System Entities and Associations
The Generate Jump-to Option microflow action generates a System.WorkflowJumpToDetails object with associated System.WorkflowCurrentActivity and System.WorkflowActivityDetails objects. The entity structure is shown in the image of the System domain model below:
The System.WorkflowJumpToDetails object is associated with the System.Workflow through the System.WorkflowJumpToDetails_Workflow association, reflecting the workflow instance for which the information is generated. It also contains System.WorkflowCurrentActivity objects through the System.WorkflowJumpToDetails_CurrentActivities association.
The System.WorkflowCurrentActivity reflects the current activities of the workflow instance and gets the description of the current activity through the System.WorkflowCurrentActivity_ActivityDetails association. It also contains a list of activities which this activity can jump to through the System.WorkflowCurrentActivity_ApplicableTargets association. The System.WorkflowCurrentActivity_JumpToTarget association is empty.
Updating Object Members to Jump to Other Activities
For the workflow to jump to other activities, you need to update the System.WorkflowCurrentActivity object members. You need to do the following:
- Set the Action enumeration attribute to JumpTo
- Set the System.WorkflowCurrentActivity_JumpToTarget association to refer to the System.WorkflowActivityDetails object
The Action attribute on the System.WorkflowCurrentActivity object is an enumeration consisting of two options:
- DoNothing (default) – the current activity does not jump to another activity
- JumpTo - the current activity jumps to the activity associated through the System.WorkflowCurrentActivity_JumpToTarget association
When the Action attribute is set to JumpTo, the System.WorkflowCurrentActivity_JumpToTarget association should refer to one of the System.WorkflowActivityDetails objects that are associated through the System.WorkflowCurrentActivity_ApplicableTargets. This ensures you select an applicable target. Referring to other System.WorkflowActivityDetails objects will lead to errors.
After setting the objects, changes can be applied by calling a microflow containing the Apply jump-to option. This will change the current activities of the associated workflow instance and queue the workflow for execution (as this happens asynchronously, execution may not happen instantly). If the workflow was in incompatible state because of versioning conflicts, the workflow is set to its previous state (for example In Progress or Paused).
Jumping to Other Activities in Parallel Splits or in Boundary Event Paths
Jumping to other activities has a limitation in parallel splits and in non-interrupting boundary event paths: it is not possible to jump into or out of a current parallel split or a non-interrupting boundary event path. However, it is possible to jump to other activities within a current parallel split or a non-interrupting boundary event path, including the end of the path. Activities in other parallel split or boundary event paths, as well as activities outside of the current path, are not available in the System.WorkflowCurrentActivity_ApplicableTargets association.