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
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.
- The clerk user fills the required details (income and loan amount), which is then sent for confirmation.
- 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.
- 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
- Follow the steps in Deploying BPMN Samples to deploy the sample using the WSO2 BPS management console.
- Log in to the BPMN Explorer using the clerk/clerk credentials.
- Select the PROCESSES tab to view the task in the task list.
- Click the Start button next to the LoanApprovalProcess sample.
- Fill in the required details (i.e., income and loan amount) and click Start.
- 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.
- 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.
- After submitting revised amount, a task will get created to the manager to approve/reject the request.