Conditional Processing
The final step in this assignment is to implement a decision point in the process.
You’ve seen that the process takes a variable as input (dev_prod_support) that determines whether or not the new developer will be providing support for production systems straight away.
If that’s the case, the developer’s account needs to be added to the pager duty system, which is a manual action.
Go to Camunda Modeler and add an exclusive gateway just before the end event.
Name the gateway as a question: Support production systems?.
Connect two paths from Support production systems?: one to another exclusive gateway (this one needs no name) and the other to a new user task called Set up pager duty.
Set up pager duty is also connected to the second gateway, that now joins the two paths again before the process ends.
Give the outgoing sequence flows for Support production systems? logical names that answer the question of the gateway: Yes and No.
| This is a typical process pattern to add conditional processing: a decision is made to either pass through to the next steps or to follow a different path that contains the activities that are conditional. |
Set the Conditions
There’s one step left: the actual condition still needs to be set.
Select the sequence flow that says Yes and is linked to the Set up pager duty user task.
Go to the properties panel and open the Condition section. Select the Expression type from the dropdown and enter the following expression.
${dev_prod_support}
Make sure to copy the full expression, including the dollar sign and braces.
This is a check for a boolean value in the variable dev_prod_support that is true.
Add the opposite condition to the No sequence flow.
${not dev_prod_support}
This checks that the value of dev_prod_support is false.
| If you’re wondering about the syntax of these expressions, it’s JUEL, an expression language that’s supported by the Java Virtual Machine, and thus is available to Camunda for evaluating expressions. |
Deploy and test the process. Make sure to check both paths. TIP: You can use the History view of the process definition to see which paths have been taken how many times.
Bonus
If you have time left, consider changing the Set up pager duty task type to a service task and adding another service implementation for it. See if you can extract the dev_account_id variable from the process instance and log that information as part of the implementation. Use the existing services as an example.