HomeGuidesRecipesAPI
HomeGuidesAPILog In

Parallel Workflows

This feature allows workflow states to be assigned to users simultaneously, and for the workflow to progress only once all concurrent states have been completed. Question references are resolved concurrently across all states in a parallel section. Parallel sections can optionally be exited from without requiring consensus between assignees, and tasks can be reassigned without affecting the other parallel tasks. However, termination of a parallel task will result in the termination of all tasks in the same parallel section.

Additionally, concurrent editing can be blocked to ensure that no submissions are overwritten.

Consider the following example for a workflow:

In this example, the flow of control is simple with single expectations at each state. Now consider the example below:

In this case, a “2-step authorization” process is involved. The issue with this is that if one of the authorizers is not available, the allocated task is held and can only be progressed by the actions of an administrator.

Parallel Workflows allow a part of the workflow to run concurrently. Using this approach, we can alter the process above as follows:

  1. Remove the Authorize 1 and Authorize 2 states from the main workflow.
  2. Add a Parallel section onto the canvas, then uncheck Block Concurrent Editing in the Inspector panel (see Block Concurrent Editing).
  3. Double-click the new parallel section on the canvas or click Edit Parallel Workflow in the Inspector to open it.
  4. Drag and drop two states into the parallel field, and name them Authorize 1 and Authorize 2 respectively.
  5. Add a transition from Process to each of the Authorize 1 and Authorize 2 states.
  6. Finally, add a transition from both Authorize 1 and Authorize 2 states to (Finish).

You will get the structure as shown below:

Now when this project is run in Produce, both Authorize states can be worked on immediately, in any order, when the Process state is completed - Authorize 2 is no longer waiting for Authorize 1 to be completed.

Once both Authorize states are completed, the workflow will progress to finish.

Block Concurrent Editing

With parallel states, multiple end users may be accessing the workflow form at the same time. To prevent race conditions with potential data loss, parallel sections by default block concurrent editing.

With this option enabled, when the parallel states are assigned to their multiple assignees, the first one to open it will be able to proceed as normal and edit the form. Any other assignees, if they try to open their tasks while it is being edited by another user will be open in read-only mode. Once the user editing the form submits, or else abandons their editing by returning to Produce home, the form will once again be available for editing by another of the assignees in the parallel process.

In many cases, the form can be designed to require users in parallel to work on different parts of the form. In this case it is recommended to use conditions to only allow editing relevant form pages, sections and/or questions based on which workflow state is being worked on.

The Block Concurrent Editing setting can be turned off by selecting the Parallel section to reveal its properties in the Inspector panel.

🚧

Use with caution

It is recommended that you leave Block Concurrent Editing on when possible, and only turn off with caution once you've ensured that you are otherwise safeguarding from data loss by using conditions or some other method.

Priority Parallel Exit

A transition from a state within a parallel workflow section can be specified as a Priority Parallel Exit transition. If the conditions for this transition are met when the task is submitted, the transition executes immediately, and any tasks parallel to the submitted task will be skipped. This allows, for example, for the workflow to be returned to the initiator without requiring consensus among parallel assignees.

In this example, if Authorize 1 is allowed to authorize the workflow task without waiting for Authorization 2, select the transition from Authorize 1 to (Finish) and enable the Priority Parallel Exit option.

Adding Actions to a Workflow

Actions can also be added to a workflow to execute when:

  • All exit transitions from a parallel section have completed.
    OR
  • The state with the enabled Priority Parallel Exit option completed the task. These actions are added to the line that comes out of Exit Parallel 1.

User Specification

Assignment of parallel tasks to users must be specified in Design, or by question reference. Similarly, as states within a parallel section do not have a "Finish" page, user assignment for the transition out of a parallel section must be specified in Design, or by question reference.

Concurrent Question Reference Resolution

Once all tasks in a parallel section have been completed, the transition out of the parallel section executes for all the parallel tasks concurrently, including resolution of question references. This means that even if, for example, State X is completed last - triggering the transition to another State - it could be State Y that includes the question defining the assignee for the new State.

Termination and Reassignment of Tasks

If a parallel workflow task is terminated by an administrator, all other tasks within the same parallel section will also be terminated. This is to ensure that parallel tasks which rely on each other are not left in an unrecoverable state when some are terminated and some are not.

Reassignment of a parallel workflow task will affect only the selected task, leaving the other tasks in the parallel section alone. The parallel section will still complete as normal once all tasks (including reassigned tasks) are completed