In this section, we’ll expand our model by creating alternate paths through the workflow depending on the current workflow state, in this case, answers provided by the user through forms.
We’ve also added a second DMN table to find the cost of the selected shipping method, and we updated our order total calculations to incorporate that cost.
We’ll be using the following files from spiff-example-cli.
Exclusive gateways are used when exactly one alternative can be selected.
Suppose our products are T-shirts and we offer product C in several colors. After the user selects a product, we check to see it if is customizable. Our default branch will be ‘Not Customizable’, but we’ll direct the user to a second form if they select ‘C’; our condition for choosing this branch is a simple python expression.
Parallel gateways are used when the subsequent tasks do not need to be completed in any particular order. The user can complete them in any sequence and the workflow will wait for all tasks to be finished before advancing.
We do not care whether the user chooses a shipping method or enters their address first, but they’ll need to complete both tasks before continuing.
We don’t need to do any particular configuration for this gateway type.
Running The Model¶
If you have set up our example repository, this model can be run with the following command:
./run.py -p order_product \ -d bpmn/product_prices.dmn bpmn/shipping_costs.dmn \ -b bpmn/gateway_types.bpmn