IBM BPM, V8.0.1, All platforms > Create processes in IBM Process Designer > Create user interfaces for business processes > Coach and Coach View examples

Example: wiring Coaches in a human service

This example shows how you can wire a Coach with boundary events in a human service diagram.

To create a wire connection from a Coach in a human service diagram, a Coach must contain a Coach View that contains a control that specifies a boundary event. Any Coach View that specifies a boundary event that is added to a Coach can be selected as a boundary event and wired as such in the sequence flow.

Boundary events are specified using the Can Fire a Boundary Event setting in the Overview tab of a Coach View. The Button stock control specifies a boundary event by default.

This example shows how to configure a Coach to loop back and to proceed to the end of the service. When you wire a Coach to loop back to the same Coach, such as in a lookup service, only the specified component on the page is refreshed at run time (instead of the full page).

Prerequisite tasks for this example:

Overview of tasks in this example:

Open the Customer Form human service and complete the following steps:

  1. In the Variables tab, add the following local variable for both input and output:

    • customer; for the Variable Type, select the Customer business object.

  2. Creating the Submit Customer Coach.

    1. In the Diagram tab, drag a Coach onto the canvas and name it Submit Customer.

    2. In the Coaches tab, select the Coach and drag a vertical section onto the canvas.

    3. From the palette (under No Tags), drag the Customer Information view onto the canvas. The view properties open.

    4. For the Binding, select the customer input variable (created in step 1).

    5. From the palette, drag the Button control into the vertical section and name it Customer Lookup.

    6. From the palette, drag the Button control onto the canvas (outside of the vertical section) and name it Submit.

  3. Configure the Customer Lookup server script and sequence flow.

    1. In the Diagram tab, drag a Server Script component onto the canvas and name it Customer Lookup.

    2. In the Implementation properties, provide a script for the customer lookup feature that is similar to the following example:
      if (tw.local.customer.ID == "1234") {
          tw.local.customer.Name = "John's Restaurant";
          tw.local.customer.address = "1 anyStreet, anyCity, anyState";} else if (tw.local.customer.ID == "2345") {
          tw.local.customer.Name = "Jane's Bakery";
          tw.local.customer.address = "2 anyStreet, anyCity, anyState";}

    3. Using the Sequence Flow tool, connect the Start Event component to the Submit Customer Coach to the Customer Lookup server script and then another line back to the Submit Customer Coach to create a loop.

    4. Select the line going from the Submit Customer Coach to the Customer Lookup server script. The line properties open.

    5. For the End State Binding, click Select and then select the Customer Lookup button (created in step 2.e).

    6. Using the Sequence Flow tool, connect the Customer Lookup server script to the End Event component and then select the connecting line. The line properties open.

    7. For the End State Binding, click Select and then select the Submit button (created in step 2.f).

    Tip: Unique path information for the boundary event is displayed when you place your mouse cursor over the line.

  4. Save changes and then run the service. Your application opens in a browser.
  5. Test the features in your application.

    1. In the ID field, type either 1234 or 2345 and then click Customer Lookup. The corresponding customer name and address data is returned.

    2. To end the process, click Submit. The human service is complete.


Example artifacts

Create the artifacts listed in the following tables before you begin the example.

Tip: For properties that are not specified, accept the default settings.

Business data objects
Name Parameters
Customer (Shared Object) ID (String)

Name (String)
Address (String)

Ajax service
Name Contents
Customer ID Lookup Server Script component with added script for the lookup feature, similar to:
tw.local.results = new tw.object.listOf.String();

Packages.java.lang.System.out.println("tw.local.text: " + tw.local.text);
Packages.java.lang.System.out.flush();

if (tw.local.text.charAt(0) == '1') {
    tw.local.results[0] = "1234";} else if (tw.local.text.charAt(0) == '2') {
    tw.local.results[0] = "2345";} else {/*

	*/}

Coach Views
Name Contents
Customer Information Text controls: Customer ID, Name, and Address

  • Customer ID properties

    • Binding: Customer.ID
    • Enable Autocompletion: On

    • Autocompletion Service: Customer ID Lookup (Ajax service)

  • Name properties:

    • Binding: Customer.Name

  • Address properties:

    • Binding: Customer.Address

Human service
Name Properties
Customer Form Configure the human service using the steps in this example.

Coach and Coach View examples