Human Approval Sample

The purpose of this sample is to provide a detailed set of instructions for adding human interaction in the loan approval sample that is used in the ActiveVOS Tutorial.  To create the human interaction of approving a loan, we will leverage WS-BPEL Extension for People and WS-Human Task.  The starting point for this sample will be the completed project that is built when you run through the steps of the ActiveVOS Tutorial.  Even though this sample is self-contained we recommend that you complete the ActiveVOS Tutorial since it describes the loan process activities and how to use the ActiveVOS Designer in greater detail.

Getting Started

To start we are going to create a new orchestration project based on the Human Approval sample template.  By using this template we will create a new orchestration project which includes a complete loan approval process as a starting point that we will then modify by adding human interaction.

Step 1. Create a new Orchestration Project

  1. Open the ActiveVOS Designer and select File > New > Orchestration Project from the main menu.
  2. Enter a value of HumanApproval for the Project name and press Next.


  3. Select Human Approval from the list of ActiveVOS Samples to use the Human Approval template.


  4. Press Finish.

Preparing the process for Human Interaction

The process that we will begin with is based on the Loan Approval process that is built when you complete the ActiveVOS Tutorial.  During this part of the sample we are going to:

Step 1. Remove the LoanApprover invoke activity

Since the decision to approve or reject a loan will now be handled by a person we will update the loan approval process by removing the call to the loan approver web service.  This functionality will be replaced by a people activity.

  1. From the Navigator view expand the bpel folder and open the loanProcessHuman.bpel process.
  2. Open the Palette and drop a Sequence container on the canvas beneath the InvokeLoanApprover activity.  
  3. Select the Properties view for the Sequence and give it a Activity Name of ReviewActivities.
  4. Move the target of the link labeled large loan from the InvokeLoanApprover activity and move it to the new ReviewActivities sequence container.
  5. Move the target of the link labeled review from the InvokeRiskAssessor activity and move it to the new ReviewActivities Sequence container.
  6. Delete the link from the InvokeLoanAppover activity to the new ReviewActivities Sequence container.
  7. Your process should now look similar to this:


  8. Delete the InvokeLoanApprover activity.
  9. In the Outline view expand the Partner Links section, right-click on the LoanApproval node and delete it.

Step 2. Send an acknowledgment to the loan requester

Before we invoke the people activity it makes sense to reply back to the loan requester that the loan is now going in to a human review cycle.  We can accomplish this by adding a Reply activity.

  1. Copy the ReturnApprovalResponse activity and drop it in to the ReviewActivities sequence.
  2. Rename this activity to ReturnUnderReviewResponse.

       

Step 3: Create the message used in the acknowledgment

Before we send the Reply to the loan requester we need to format a message indicating that the loan is now under review.  We can accomplish this using an Assign containing a Copy Operation.

Within the Process Variables view, you can create a Copy Operation automatically. The copy operation that we will create will copy a literal value to the approval process variable.

  1. Display the Process Variables view, which is stacked next to Interfaces view.
  2. Right-mouse click the approval variable, and select Open.
  3. Right-mouse click the approval message, and select Copy > To, as the illustration shows.
  4. Note: The Copy > To option means create the TO side of the Copy Operation.

  5. In the Copy Operations dialog, complete the FROM part as follows:
    1. Select Literal from the Type list.
    2. Select the XML Builder button.
    3. In the Preferences dialog, notice that the matching data type, loanApprovalResponse, is selected as the Root Element. The element-based approval message is a single part element.
    4. Select Finish
  6. Change the following values in the generated XML to match the contents displayed below. 
  7. Click OK, and you will see a new Assign activity in the Process Editor. The activity is in the upper left corner.
  8. Move the Assign activity in to the ReviewActivities sequence before the UnderReviewResponse activity.
  9. Rename the Assign to Acknowledge.

Adding Human Interaction

After the acknowledgment is sent to the loan requester we can add the People activity to the process.

Step 1. Create the People Activity and Task

To create the human interaction of approving a loan, we will leverage WS-BPEL Extension for People and WS-Human Task. 

  1. From the Interfaces view, in the Port Types section, expand the LoanApproval port type and drag the approve operation to the canvas and drop in to the ReviewActivities sequence after the UnderReviewResponse activity.
  2. Select BPEL for People Activity with task (two-way operation only):


  3. Press Next.
  4. Complete the operation wizard with these instructions:


  5. Press Finish.
  6. Note: If the People Activity appears in the wrong place within the Sequence, simply drag and drop it into the proper location as shown below:


  7. Change the name of the People Activity to ReviewLoan.
  8. In the Outline view select the ReviewLoan, then select the Schedule tab in the Properties view.
  9. Create an Expiration for the people activity by selecting the Duration radio button and entering a value of 'PT180M' for the Expression:


  10. In the Outline view select the approveTask, then select the Task tab in the Properties view and set the following properties:
  11. In the Outline view select the approveTask, then select the Presentation tab in the Properties view and set the following properties:
  12. In the Properties view select the Renderings tab and set the following properties:
  13. In the Properties view select the All tab, select the Parameters properties and set the following parameters:

  14. In the Properties view select the All tab, select the Delegation properties and set the following  parameters:

Step 2. Defining Task Owners and Administrators

It was decided that a group called loanreps will be allowed to claim and work on the tasks, while a group called loanmgrs would be administrators (who can escalate and reassign tasks). In BPEL, we refer to these as Logical People Groups.

Logical People Group definitions will need to be defined for both loanreps and loanmgrs, and then the groups can be associated with the proper role for the task.

  1. From the Outline view right-click on Human interactions > Add > Human Interaction > Logical People Group


  2. From the Properties view define a group name loanmgrs.
  3. To add sample users to the new group select the All tab in the Properties view and press the ellipses button (...) next to the People Group Value property:


  4. On the Organizational Entity Definition dialog press the Generate User button to generate sample XML that can be modified to define some sample users for the group.  Modify the generated XML to define two users, loanmgr1 and loanmgr2 as shown here:


  5. Press the OK button to save the changes.
  6. Repeat steps 1-5 to create a new Logical People Group named loanreps with the following two users:

Step 3. Bind the Task Owners and Administrators to the Task 

Now that the Logical People Groups have been defined we need to assign those groups to the in-line task that was created in our People activity.

  1. In the Outline view select the approveTask, then select the Assignment tab in the Properties view:


  2. By clicking on the ellipses button (...) next to Potential Owners and Business Administrators you can assign the role of loanreps to Potential Owners and loanmgrs to Business Administrators resulting in the following:


  3. Set the Task Initiator property to use a value of "Loan Process" by clicking on the ellipses button (...) then
  4. Save the process.
     

Step 4. Setting Task Deadlines

You can specify one or more deadlines by which a task must be started and also one or more deadlines by which a task must be completed. If a particular start date or completion date is missed, you can trigger one or more escalation actions. For example, if you set a start the task deadline for two hours after a task has been created and the deadline is missed, you can send a notification to the task owner.  We are going to set the following deadlines:

    Step 4a. Setting the Start Deadline

  1. From the Outline view select the approveTask node and select the Deadlines tab in the Properties view.
  2. Click the Add button and set the following properties:
  3. Press OK.
  4.  Click in the blank value under the Expression column and presses the ellipses button (…) and set the duration expression shown below:
  5. Repeat steps 1-4 and create a completion deadline for 10 minutes later ('PT130M')
  6. The two task deadlines appear in the Properties view as shown here:
  7. In the Outline view select the Start Deadline and press the Escalation tab in the Properties view.
  8. Select the Inline Notification labeled InlineNofication1 and press the Go To button.
  9. In the Properties view select the Notification tab and change the name to FiveMinuteReminder.
  10. In the Outline view expand the FiveMinuteReminder node and select the child node labeled N1.  
  11. In the Properties view select the Notification tab and set the following properties:
  12. In the Properties view select the Presentation tab and set the following properties:
  13. In the Properties view select the Assignment tab and set the properties as shown in the below by pressing the ellipses (...) button in the Value column:
  14. In the Properties view select the All tab, select the Parameters properties and set the following presentation parameters:

    Step 4b. Setting the Completion Deadline

  1. In the Outline view select the Completion Deadline and press the Escalation tab in the Properties view.
  2. Select the Inline Notification labeled InlineNofication1 and press the Go To button.
  3. In the Properties view select the Notification tab and change the name to EscalateIfNotActedUpon.
  4. n the Outline view expand the FiveMinuteReminder node and select the child node labeled N1.  
  5. In the Properties view select the Notification tab and set the following properties:

  6. In the Properties view select the Presentation tab and set the following properties:
  7. In the Properties view select the Assignment tab and set the properties as shown in the below by pressing the ellipses (...) button in the Value column:
  8. In the Outline view select the Completion Deadline and press the Escalation tab in the Properties view.
  9. Press the Add button and specify Reassignment for the Escalation Type:
  10. Select the Reassignment labeled Reassignment1 and press the Go To button.
  11. In the Properties view select the Reassignment tab and change the name to ReassignToMgr1.
  12. In the Properties view select the Assignment tab and set the properties by pressing the ellipses (...) button in the Value column:
  13. That's it.  The People activity is now complete with escalations and notifications.

Completing the Human Review

In this section we will update the loan approval process by invoking a web service that will notify the Customer Service Department of the status of the loan.

Step 1. Notify Customer Service of Decision

  1. From the Interfaces view, in the Partner Link Types section, expand the LoanCRMLT partner link type and drag the notify operation to the canvas and drop in to the ReviewActivities sequence after the ReviewLoan activity.
  2. Select Invoke for the Activity Type. 
  3. Press Next.
  4. Choose the Create new Partner Link option, set the Name to LoanCRMLT and the Location to Process.
  5. Press Next.
  6. Choose the Use existing Variable option and make sure that approve-task is selected.
  7. Press Finish.
  8. In the Properties view set the Activity Name to NotifyCustomerServiceOfDecision.
  9. Save your process.  Your process should now look similar to this:
  10. The modifications to the process are now complete.

Updating Fault Handling

In this section we will update the fault handlilng of the original loan approval process to handle an expired human task.

Step 1. Notify Customer Service if the human task has expired
  1. Select the Fault Hanlders tab.
  2. From the Palette drag a Catch activity and drop it on the canvas.
  3. In the properties view set the following properties:
  4. From the Interfaces view, in the Partner Link Types section, expand the LoanCRMLT partner link type and drag the notify operation inside the new Catch acvitiy.
  5. Create an Assign activity in the fault handler before the NotifiyCRMOfExpiration activity and set the following properties:
  6. In the Properties view set the Activity Name for the Assign to: CreateExpirationResponse.
  7. Create a link from the CreateExpirationResponse to the NotifyCRMOfExpiration activity.
  8. Your fault handler should now look similar to this:
  9. Save your process.

Simulating the Process


Now that the process is complete it would be a good time to simuate the execution of the process prior to deploying and running the process live on the server.  Detailed instructions for simulating the Loan Process are described in Tutorial Part 8:  Simulating the Process of the ActiveVOS Tutorial so they are not repeated here.  Once you are statisfied that your process behaves as expected you can turn your attention to deploying the process and running it on the ActiveVOS Server.

Preparing for Deployment

In this section we will prepare the process for deployment by creating the Process Deployment Descriptor (.pdd) file.  For more information on the deployment please refer to the Deploying your Processes chapter in the ActiveVOS Designer Help system.

Step 1: Create a process deployment descriptor

A Process Deployment Descriptor (.pdd) file describes the relationship between the partner links defined in the BPEL file and the implementation required to interact with actual partner endpoints. You create a .pdd file to add address information about your endpoint references. The .pdd file is an integral part of the deployment package for the process.


  1. In the Navigator view right-click on the loanProcessHuman.bpel process and New > Deployment Descriptor to open the New Deployment Descriptor dialog.
  2. Select the deploy folder, and press Finish, as shown.
  3. The loanProcessHuman.pdd file is opened in the PDD editor as shown below.  Notice that the properites of the General tab are displayed.
  4. Accept the defaults on the General tab and press the Partner Links tab to define the bindings to the web services called by the process.
  5. Set the runtime bindings for the LoanCRMLT partner link by clicking on the LoanCRMLT row and set the following properties:
  6. Set the runtime binding information for the RiskAssessment partner link by selecting the RiskAssessment row and set the following properties:
  7. Next set the runtime binding information for the LoanProcess partner link by selecting the LoanProcess row and setting the following properties:
  8. The final step is to bind the Logical People Groups to actual server roles.  Select the People tab and set the following properties:
  9. Save the file.
     

Running the Process on the Server

Your process is now ready to be deployed.  Deployment is the act of publishing your BPEL process to the ActiveVOS server where it can run. Once the process is deployed you can run it on the server. The steps for deployment and running the process on the server are defined in the Human Approval Completed documentation.