BEA Logo BEA WLI Release 2.1

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

   WLI Doc Home   |   BPM Topics   |   Learning to Use BPM   |   Previous Topic   |   Next Topic   |   Contents   |   View as PDF

Creating a Workflow

 

This section of the tutorial shows you how to create the Order Processing workflow. After a high-level overview of the workflow, we do the following:

 


Overview of the Order Processing Workflow Design

The Order Processing workflow handles the processes from receiving the order to checking customer credit and checking inventory. It then passes control to the Order Fulfillment workflow, which handles shipping and invoicing. When the Order Fulfillment process is complete, control is returned to the Order Processing workflow, which confirms the order completion.

The following figure provides a high-level depiction of the workflow in Interface View. The numbered steps in the figure are described in the table that follows the figure, which maps the real-world processes to the workflow model.

Figure 4-1 Order Processing Workflow: Interface View


 

Table 4-1 Order Processing Workflow Summary

Process

Implementation

The order is received by a processing system, which reads the data and appends an ID number to the order.

1. The workflow is started by an incoming XML document.

The order is forwarded to a customer service representative, who checks the customer's credit information.


2. An XML message is sent to a Worklist user to confirm the credit check.

3. A decision evaluates whether the response from the Worklist user is yes or no.

If the credit check fails, the customer service representative is assigned the task of contacting the customer to obtain correct credit information, and the process becomes manual from this point on.

4. The task of contacting the customer is assigned to a Worklist role, and the workflow terminates.

If the credit check passes, the system checks a database for the current inventory of the ordered item, according to the item ID, and it compares the quantity of items available with the quantity requested.

5. An EJB is called to check the inventory.

6. A decision evaluates whether the inventory is sufficient.

If the amount of stock is not sufficient to accommodate the order, the order is placed on hold until new inventory arrives. When the system receives notice of new incoming inventory, it repeats step 5 until it can verify that the inventory is sufficient to process the order.

7. An event node waits for an incoming XML document. When the event is triggered, the flow loops back to the inventory-checking task node.

If the inventory is sufficient, the order is forwarded to two human agents simultaneously: one agent arranges shipment; the other instructs the system to generate an invoice for the order.

8. The Order Fulfillment sub-workflow is called.

The system confirms that the order has been shipped and notifies the customer via e-mail.


9. An e-mail may be sent to the customer.

10. The workflow terminates.

At any point in the transaction before shipping, the order can be cancelled by notification from the customer.

11. An event node waits for an incoming XML message.


 

 


Creating a Template

When you create a workflow template, you specify the organizations with which you would like to associate it.

Note: If you associate a template with multiple organizations, any changes you make to the template are automatically reflected when viewing the template from different organizations.

To create the Order Processing template:

  1. In the Studio folder tree, right-click the Templates folder and select Create Template from the pop-up menu. The Template Properties dialog box appears.

    Figure 4-2 Template Properties Dialog Box


     

  2. In the Name field, enter Order Processing, and from the Organizations list, select the CDExpress check box.

  3. Click OK. The Order Processing template is added under the Templates folder in the folder tree.

 


Creating a Template Definition

When you create a template definition, you specify effective and expiry dates. By default, the effective date is the current date and there is no expiry date.

To create the template definition for the new workflow template:

  1. Under the Templates folder, right-click the Order Processing template and select Create Template Definition from the pop-up menu. The Template Definition Order Processing dialog box appears.

    Figure 4-3 Template Definition Order Processing Dialog Box


     

  2. Optionally, enter an effective date and expiry date (be sure that your dates will allow you to run the workflows), and click OK.

The workflow design window opens, with a simple default workflow containing a start node, a task node, and a done node, and two actions within the task node: Assign Task to User WorkflowAttribute("Initiator") and Mark Task as Done. These are the minimum workflow objects that are required to define an executable workflow.

Figure 4-4 Workflow Design Window


 
 

 


Drawing the Flow

You use the toolbar icons in the workflow design window to draw your flow. In this section we draw the Order Processing workflow by placing node shapes in the workflow design area, and then connecting and renaming them.

Placing Shapes

Our workflow design requires the following shapes:

To add a shape, do the following:

  1. Click the icon for the shape on the toolbar.

  2. Click anywhere in the workflow design area.

  3. Release the mouse button to drop the shape.

Note: Shapes are initially assigned a number when you place them. However, the final order of the shapes within the flow does not matter.

Renaming Nodes

Before we connect the nodes, let us rename them, to make it easier to identify them.

Note: Decision nodes must be named with expressions, usually containing variables. Because you must first create the variables to be used in conditional expressions, you will name the decision nodes in Defining Workflow Nodes.

To rename task and event nodes:

  1. In the workflow design area, double-click a node to invoke its Properties dialog box.

  2. In the Name field for a task node, or the Description field for an event node, enter the name for the node, as listed in the following table.
     

  3. Click OK to exit the dialog box. The name now appears on the node in the workflow design area.

  4. Repeat steps 1 to 3 for all the nodes listed in the table.

Note: Do not worry if your names do not correspond exactly to the node numbers in the table. The final order of the shapes within the flow does not matter.

Arranging Shapes and Connecting Nodes

We now move the shapes around and connect the nodes so that the final flow appears as in the following figure.

Figure 4-5 Order Processing Workflow: Final Design


 

To move a shape, drag and drop it anywhere within the workflow design area.

To make a connection, you can use one of two approaches: from the toolbar or from a Properties dialog box for the node.

To make a connection from the toolbar:

  1. Click the Connection button on the toolbar.

  2. Click the node from which you want to begin the connection and drag to the node at which you want to end the connection, and then release the mouse button to make the connection. For Decision nodes, you are prompted to select a True or False connection.

To make a connection from a node's Properties dialog box:

  1. Double-click the source node from which you want to draw the connection. Its Properties dialog box appears.

  2. On the Next tab, select the target node to which you want to connect. For Decision nodes, select the node from the Next True and Next False tabs.

To delete a connection, you can use one of two approaches: from within the drawing area or from the Properties dialog box for a node.

To delete a connection from within the drawing area:

  1. Right-click on the desired connection, and from the pop-up menu that appears, select Delete Connection.

  2. When prompted, confirm deletion by selecting Yes.

To delete a connection from a node's Properties dialog box:

  1. Double-click the source node from which the connection is made to invoke its Properties dialog box.

  2. On the Next tab, deselect the target node to which the source node is connected. For Decision nodes, deselect the node from Next True and Next False tabs.

 


Adding a Workflow Label

In Understanding Workflow Expressions: Viewing the Set Workflow Variable and Assign Task to User Actions, you saw that in the Order Processing Trigger workflow, the variable OrderID was set to be incremented by 1. Now we will create a label which displays that information in the run-time applications, so that each instance of the workflow will have a unique label.

To create a workflow label, you specify a workflow expression. To display the label Order number, we use the following expression.

Listing 4-1 Workflow Label

"Order " + $OrderID

To add our label, we must also create the variable OrderID that corresponds to the variable that already exists in the Order Processing Trigger workflow. Since we can create a variable from within the Expression Builder, the following procedure combines creating a variable with defining an expression.

Creating an Expression with the Expression Builder

To create the OrderID variable and define the workflow label:

  1. With the Order Processing template definition open, right-click its folder in the folder tree, or anywhere in the workflow design window, and from the pop-up menu, select Properties. The Template Definition Order Processing dialog box appears, now with the Workflow Label field displayed.

    Note: This field is not available when you first create the template definition, but only after you have opened it.

    Figure 4-6 Order Processing Template Definition Dialog Box: Workflow Label Field


     
     

  2. Click the button next to the Workflow Label field. The Expression Builder appears.

    Figure 4-7 Creating a Variable from the Expression Builder


     

  3. Select the Variables option and, in the list of variables in the right pane, double-click NEW. The Variable Properties dialog box appears.

    Figure 4-8 Variable Properties Dialog Box


     
     

  4. Enter the relevant information for the OrderID variable, as listed in the table below.
     

    The new variable now appears under the Variables folder in the folder tree.

  5. Click OK to close the Variable Properties Dialog Box. The variable now appears in the Expression field of the Expression Builder dialog box.

    Figure 4-9 Using the Expression Builder


     
     

  6. Continue to build the expression shown in Listing 4-1 by doing any of the following:

    When done, your Expression window should look like the following window.

  7. Click OK to exit the Expression Builder dialog box. Your expression now appears in the Workflow Label field of the Template Definition properties dialog box.


     
     

  8. Click OK to exit the Template Definition Order Processing dialog box.

 


Activating the Workflow

To make the workflow available to be run, you must activate it.

To activate the Order Processing workflow:

  1. With the Order Processing template definition open, right-click its folder in the folder tree, or anywhere in the workflow design window, and from the pop-up menu, select Properties. The Template Definition Order Processing dialog box appears, now with the Active check-box displayed.

    Note: This check box is not available when you first create the template definition, but only after you have opened it.

    Figure 4-10 Order Processing Template Definition Dialog Box: Active Check Box


     
     

  2. Select the Active check box.

  3. Click OK to exit the dialog box.

 


Saving the Workflow

A workflow cannot be run if it has not been saved at least once.

To save the Order Processing workflow, with the template definition open, right-click its folder in the folder tree, and from the pop-up menu, select Save.

In the next section, you will add and define all the variables and actions required by the workflow. Remember to save your workflow periodically as you proceed through the remainder of the tutorial.

 

back to top previous page next page