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

Claims Approval Task with Multiple User Stores Sample

This sample demonstrates how to assign tasks to users when there are multiple user stores. Refer the Multiple User Stores with Human Tasks section for more information.

Setting up the sample

Creating the required roles and users

Before you run the sample, you must create two users with different roles. First, you should setup a secondary user store with the domain name ‘abc.com’ using instructions in Configuring Secondary User Stores.

To create the roles:

  1. In the BPS management console, go to Configure > Users and Roles > Roles.
  2. Click Add New Role.
  3. Enter regionalManagerRole for the role name, keep PRIMARY as the domain name and click Next.
  4. Select All Permissions to give all permissions to this role to the role created and click Finish (the user can be added later).
  5. Repeat these steps to create another role called regionalClerksRole, this time change the domain name to ‘abc.com’.

To create the users:

  1. Go to Configure > Users and Roles > Users.
  2. Click Add New User.
  3. First, you must create a user who has the regionalManagerRole role. Do the following to achieve this.
    1. Enter regionalManagerUser for the user name, select PRIMARY for domain and enter any password, and then click Next.
    2. Select regionalManagerRole and click Finish.
  4. Repeat these steps to create another user with username regionalClerkUser for the domain ‘abc.com’ and assign the regionalClerksRole as the role. 

You now have the two users and are ready to deploy the sample.

Deploying the sample

If you already deployed a human task sample, delete the relevant ZIP file from the <EI_HOME>/samples/business-process/humantasks directory to undeploy it before deploying another sample.

You can now deploy the ClaimsApprovalTask sample by adding the tasks and process associated with the sample.

To add the tasks:

  1. Go to Main > Human Tasks > Add.
  2. Browse to and select the ClaimsApprovalTaskWithMultipleDomains.zip file, which is located in the <BPS_HOME>/repository/samples/humantask directory and click Upload.
  3. Click OK in the confirmation message and then refresh the page.
  4. The ApproveClaim and ClaimApprovalReminder task definitions appear in the deployed task configurations list. You can click a task definition to view it.

To add the process:

  1. Go to Main > Processes > Add.
  2. Browse to and select the ClaimsApprovalProcess.zip file, which is located in the <BPS_HOME>/repository/samples/bpel directory and click Upload.
  3. Click OK in the confirmation message, wait a few moments, and then refresh the page.
  4. The ClaimsApprovalProcess process is now deployed and appears in the Deployed Processes list.

Running the sample

You can now run the sample by using the following instructions.

  1. Go to Main > Processes > List.
  2. In the Process ID column, click the process ID for ClaimsApprovalProcess:http://www.wso2.org/humantask/claimsapprovalprocess.bpel}ClaimsApprovalProcess-1The Process Information screen appears, displaying information about this process.
  3. In the WSDL Details section of the process information screen, select claimsApprovalPartnerLink from the Partner-Links list, and then click Try It. A new browser window appears where you can replace the placeholder values with the values you want to send.
  4. Replace the sample with the following values:

  5. You can now view this process instance in the management console. Go to Main > Business Processes > Instances in order to do this.
  6. Notice that the ClaimsApprovalProcess-1 instance has been created and is active. Click the instance ID to view the activity flow. The flow of the process depends on the value we specified for the amount property. If the amount is less than 1000, the BPEL process handles the approval, so the process terminates without initiating the human task. If the amount is over 5000, as we specified above, the ClaimsApprovalTask is initiated, and the process waits until it receives approval from the human task activity. 
  7. To view this task, you must log in as the user who is assigned this task. This involves the following.
    1. Click Sign-out, and then log in as the regionalClerkUser.
    2. Go to Main > Human Tasks > List. (Click the link lower down in the left navigation pane, not the one in the Manage group).
  8. The task appears in the My Tasks list. In the Task ID column, click the link for the task.
  9. Click Start to start the task.
  10. To approve the request, click Approve in the Response section, and then click Complete.
  11. Go to Main > Business Processes > Instances. You can see that the instance, which was previously waiting for approval, is now completed successfully.

So, in short, users only have to refer to the users and roles correctly with the domain prefix when they are in secondary domains.