To route the case to one task or another, the routing rules need to be defined in the exclusive gateway, which was added between the "Submit Request" and "Deliver Order" tasks. To do this, right click on the gateway and select Properties from the menu to define the routing rules for the gateway.
If the supervisor selects "Yes" in the "Order Approval" field, then the "requestApproved" variable will be set to 1, whereas it will be 0 if "No" is selected. Add conditions to check for these two values.
To route to the "Submit Request" task, set the condition to @@requestApproved==0
To route to the "Deliver Order" task, set the condition to @@requestApproved==1
.
Now, the process will loop back to the "Submit Request" task if the supervisor rejects the purchase request, or go onto the "Deliver Order" task if the Supervisor approves it.
Remember when writing conditions that variables are accessed as @@variable
and variable names are case sensitive. Also remember that ==
means "equals to", whereas =
assigns a value to a variable. Do not use =
if testing for equality. If comparing a string rather than a number, remember to enclose it in quotation marks, like this: @@someField == "someValue"
To learn how to construct more complex conditions, see Using Conditions.