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/.

Call Activity Sample

The Call Activity Sample ( CreditApprovalProcess.bar ) can be found in the <BPS-HOME>/repository/samples/bpmn directory. It consists of two BPMN processes:

  • CallActivitiSample process
  • loanCheck process

In this particular scenario, the CallActivitySample process invokes the independent LoanCheck process to verify the loan. All tasks in this scenario have been assigned to the admin (username:admin, password:admin) for the purpose of demonstrating the usage.

Flow of the sample 

  1. The user is given a form to fill that includes his/her name and salary.
  2. Using the call activity, the loanCheck process is invoked, which checks whether the user is eligible for a loan.

    Condition: If the salary of the user > 100000, the loan is approved. Otherwise, the loan is rejected. 

  3. The user must verify the salary and the status of the loan.

Main process

The following diagram illustrates the flow of the main process as described above. 

 

Process invoked by the call activity

The following diagram illustrates the process invoked by the Call Activity. This process (loanCheck) is an independent process that can be reused by any other process.  

 


The XML code snippet for the call activity in the main process is as follows:

<callActivity id="callActivity" name="CallActivity" calledElement="loanCheck_1">
    <extensionElements>
        <activiti:in source="salary" target="salary"></activiti:in>
        <activiti:out source="status" target="loanStatus"></activiti:out>
    </extensionElements>
</callActivity>
Properties and VariablesDescription
calledElement

This property references a process definition by its key. Here, it references the ID of the process that is to be invoked.
<calledElement="<process-to-call>">  

Note: The process definition of the subprocess is resolved at runtime, i.e., the subprocess can be deployed independently from the calling process if required.

salary When the subprocess starts, the value of the "salary" variable is passed/copied from the main process to the "salary" variable in the subprocess.
loanStatusWhen the subprocess has finished executing, the value of the “status” variable in subprocess is passed/copied to the “loanStatus” variable in the main process.

Running the call activity 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 admin/admin credentials.
  3. Select the PROCESSES tab to view the task in the task list.
  4. Click the Start button next to the CallActivitiSample.
  5. Select the MY TASKS tab. You will see that a task has appeared on the list.  Complete this task to obtain credit information.
  6. Click the provided task and enter the required details (e.g., name and salary). 
  7. Select the MY TASKS tab. You will see that another task has now appeared on the list. Complete this task to verify the loan.
  8. Once you have completed the task, another task will appear on the list. This task indicates whether the load was approved or rejected.