Gateways represent decision points in the process. They split or merge the flow of the process and control which path will be taken depending on certain conditions.
For example, suppose an employee has prepared an invoice. If the amount is large, it must be approved not only by the employee's immediate supervisor but also by the CEO. If the amount is insignificant, then the employee will be given money right away.
The exclusive gateway activates only one outgoing connector.
This is how it works. First, you specify the conditions for the gateway outgoing connectors. In this article, we describe in details how to do it.
When the process flow comes to the gateway, the system evaluates the conditions and selects the connector which meets the condition. The conditions are evaluated in the order they appear in the gateway settings, on the Connectors tab.
Note that for the exclusive gateway, the default connector must be specified.
For example, in the sales process, a salesperson may offer optional services to the client. Depending on the decision of the buyer, the process will either end, or the salesperson will be assigned the task of drawing up a service agreement.
The Inclusive gateway activates one or more process paths based on the conditions on the outgoing connectors.
For example, after an operator accepts an order, the following alternative flows can be created depending on the conditions:
- if the order amount is > 1000 dollars, the operator will add gift A to the order
- in case of instant payment, the buyer will be offered gift B
- if both conditions are met, the buyer will receive the two gifts.
- if no conditions are met, QuickBPM will skip the gateway operations and immediately assign the task to deliver the goods.
Please note that each diverging inclusive gateway requires a similar converging gateway.
The Parallel gateway activates all the outgoing connectors.
This gateway is very different from the ones described above, as it does not evaluate the conditions of the connectors.
A parallel gateway is used to split the process into several flows that will be executed simultaneously.
Note that all process paths originating from a diverging parallel gateway must come to a similar converging gateway.
For example, after a new employee is hired, the office manager will have to prepare the work area, the system administrator will create an account in the corporate system, and the hr-specialist will prepare a welcome package for the newcomer. All these tasks can be performed simultaneously, therefore, to describe the process, it is advisable to choose a parallel gateway.
You can rename gateways, add a description, change the type, as well as set the order in which connectors conditions will be evaluated. To open the settings window, click on the gateway shape on the process diagram.
- Name – in this field you can specify the name of the gateway that will be displayed in the process diagram
- Description – here you can describe how exactly the gateway works
Gateway type – a drop-down list that allows you to change the gateway type.
Service variable tab
The Service variable tab is available for exclusive and inclusive gateways. The value of this variable is calculated with a script, and it helps define which connector should be activated.
For example, for an invoice approval process you can create a Total including VAT variable. If the variable's value is higher or equal to 10 000, then the process should take the Approval required path. In all the other cases, the process will go by the Issue payment path.
To set up the gateway as shown in out example, check the User service variable in connector conditions option.
Next, specify the variable's type. In our case, the type is Integer, since the variable must store the total amount of an order.
Add a script to calculate the variable's value. For that, either click Create or select an existing script from the list. Specify its name, once again click on Create, and then click Open. The Scripts tab will open, where you can use TypeScript to create your script.
For more information on creating scripts, please read this article.
Save and check the script. If there are any errors, the editor will underline them. Scripts with errors cannot be published.
Once the script is published, QuickBPM will be able to execute the script and automatically calculate the total amount including VAT, when the process reaches the gateway.
In our example, the process shall activate the Issue payment connector if the total amount is less than 10 000. In all the other cases, the Approval required connector will be activated.
To implement this logic, define the conditions of your connectors. To do so, open the Connectors tab of the gateway's settings window.
Select the Issue payment connector as the default one. Then click on the Approval required connector in order to specify its condition.
In the opened window, go to the Conditions tab and click +Condition.
- Operand 1 – select the Gateway service variable;
- Operation – specify the operator for checking the condition;
Operand 2 – enter the required value.
Save the settings. Now, as the process progresses and reaches the gateway, QuickBPM will automatically calculate the value of the Total including VAT variable by using the script. With the value higher than or equal to 10 000, the process flow will take the Approval required path.
Using a service variable allows you to make the process diagram more readable because the script is contained within the gateway instead of being added to the diagram as a separate shape.
This tab is available only for exclusive gateways. Here you can specify the order in which the conditions will be evaluated and select the default connector.