Toggle menu

Making Decisions - Gateways and Sequence Flows

As your process is executed, the flow of work could take a variety of paths, passing the work on to different users and activities, depending upon the logic you write.

Note that, although an activity can have multiple sequence flows leading directly from it, we recommend the use of gateways to help keep the structure of your model clear.

Sequence Flows

The logic that controls the flow of work in a process is placed upon the sequence flows (the arrows) that join activities together. Sequence flows that have flow conditions set on them are known as conditional flows. Conditions are evaluated, and should return either true or false. Depending on the gateway being used, one or more of the flows will be followed.

A Single Condition

In this example, the execution will pass from the gateway to one of the two user tasks, depending upon the value of a process variable. The variable is the value of a form field, called PRIORITY.

Conditional Sequence Flow
 

The downward flow is the default flow, as seen by the slash on the arrow.

The flow to the right will be followed if the "form_PRIORITY" process variable has the value "HIGH" (ie if the expression form_PRIORITY=="HIGH" returns true):

Flow Properties
 

${form_PRIORITY=="HIGH"}

More Complex Conditions

You can use UEL operators to write more complex logical conditions in your sequence flows. Examples include:

${VARIABLE1=="RED" && VARIABLE2=="BLUE"} //Both variables must have these values
${VARIABLE1==true || VARIABLE2==true} //Either variable must be true
${(VARIABLE1==true && VARIABLE2==false ) || (VARIABLE3==true)} //Either the first expression in brackets must be true or the second must be true

Gateways

Exclusive Gateway

Exclusive gateway
 

When your process execution reaches an exclusive gateway, outgoing sequence flows are evaluated in the order you set in the gateway's "Flow order" property.

The first sequence flow that evaluates to true (or which doesn't have a condition set) is selected for continuing the process.

Example

Example Exclusive Gateways
 

The above diagram shows an example where a document will be given to either user A or user B for approval, and the second gateway waits for either incoming path to reach it before continuing.

Parallel Gateway

Parallel gateway
 

When your process execution reaches a parallel gateway, the execution forks into multiple paths of execution. No conditions can be set on the sequence flows - they will all be followed. Parallel gateways can also be used to join flows together:

  • Fork: all outgoing sequence flow are followed, creating a concurrent execution for each
  • Join: all executions arriving at the parallel gateway wait in the gateway until an execution has arrived from each of the incoming sequence flows. Then the process continues past the joining gateway

Note that parallel executions are not strictly concurrent. While each will exist in a concurrent state once created, executions are created sequentially, with each subsequent execution coming into existence once the previous reaches a wait state (ie a user task, timer, or asynchronous task). See Workflow Transactions - Foreground and Background Jobs for more information.

Example

Example Parallel Gateways
 

The above diagram shows an example where a document will be given to both user A and user B for approval and they must both approve it before the second gateway will allow execution to proceed past it.

Inclusive Gateway

Inclusive gateway
 

An inclusive gateway is like a parallel gateway with conditions. All of the outgoing sequence flow conditions are evaluated in the order you set in the "Flow order" property and the execution may run in parallel if more than one can be followed.

Example

Example Inclusive Gateways
 

In the above example, the document will be sent to either user A, user B, or both for approval. The gateway will wait for as many approvals as were requested to complete before continuing.

Event Gateway

a
 

The event gateway allows the process to take a decision based on events. An event gateway will have multiple outgoing paths, each of which is waiting for a timer, signal or message. It will wait for all these events in parallel, but as soon as one branch becomes active (because the timer has fired, its message has been received etc) the other branches are terminated.

Example

Example Event Gateways
 

The above example shows a process where a publication will be released on its publication date unless the process receives a message indicating that it has been cancelled, or a signal indicating that all upcoming publications have been cancelled. The event gateway makes all these events mutually exclusive, whichever one happens first will prevent the process from continuing to listen for the others.

Last modified on 22 January 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon