This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Conditional Branching

Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation:

  • <PRODUCT_HOME>/repository/samples/ directory that includes all Business Process profile samples and their artifacts is changed to <EI_HOME>/samples/business-process/.

The conditional branching sample ( LoanApprovalProcess.bar ) can be found in the <BPS-HOME>/repository/samples/bpmn directory. 

Flow of the sample

In this sample scenario, a loan approval process is displayed.

  1. The clerk user fills the required details (income and loan amount), which is then sent for confirmation.
  2. At the exclusive gateway, if the loan amount is higher than 50,000, a request is sent to the clerk user to revise the loan amount. In this case, the user can revise and resubmit the loan application.
  3. If the loan amount does not exceed 50,000, the "review application" task is triggered and the manager user can approve the loan application. 

The following XML code snippet is the LoanProcess.bpmn definition of the exclusive gateway that declares the condition mentioned above.

<sequenceFlow id="flow4" sourceRef="exclusivegateway1" targetRef="usertask3">
    <conditionExpression xsi:type="tFormalExpression"><![CDATA[${loanAmount>50000}]]></conditionExpression>
</sequenceFlow>

Note: usertask3 is the id of the "revise amount" task. At the declaration of the exclusive gateway, flow3 is defined as the default. This makes "review application" the default task that will be executed after the condition.

<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway" default="flow3"></exclusiveGateway>

Running the sample

  1. Follow the steps in Deploying BPMN Samples to deploy the sample using the WSO2 BPS management console. 
  2. Log in to the BPMN Explorer using the clerk/clerk credentials.
  3. Select the PROCESSES tab to view the task in the task list.
  4. Click the Start button next to the LoanApprovalProcess sample. 
  5. Fill in the required details (i.e., income and loan amount) and click Start.
  6. If the loan amount is less than 50,000, login to the bpmn-explorer using the manager/manager credentials and select the MY TASKS tab. You will see the that another task has appeared on the list to inform the manager.

  7. If the loan amount is more than 50,000, logout and login to the bpmn-explorer using the clerk/clerk credentials and select the MY TASKS tab.  You will see the that another task has appeared in the list to revise the loan amount. 

  8. After submitting revised amount, a task will get created to the manager to approve/reject the request.