Build it yourself

In this sample you will use the partially completed twx file. The steps to import the incomplete twx file in IBM Process Designer are given in the sections below.
 
To build, test and run the invoice process sample, follow these steps:

 

Download and Install partially completed Process App

To import process application in IBM Process Designer, complete the following steps:
  1. Download Invoice_Process - Invoice_Process_Version_1.0.twx  from the download section to  a  temporary  directory.
  2. In the IBM Process Designer, click the Import Process App link.

  1. In the Import Process App window browse the Invoice_Process - Invoice_Process_Version_1.0.twx file you downloaded to the temporary directory in step 1 and click Next.
  2. You can see the process app imported in the list of process applications.
  1. Click the Open in Designer link to open process application.

Create Users and Groups

  1. In a browser, open the Process Admin console. The default URL is http://localhost:9080/ProcessAdmin to create Users and Groups.
  2. If security is enabled, enter a valid User ID and Password. Click Log in.
  3. In the navigation pane, select User Management à User Management.
  4. Enter the following information:
    1. In the User Name, type pa1
    2. In Full Name, type Process Assistant 1
    3. In the Password pa1edu,
    4. In Confirm Password, retype the password and click Add.
  1. Similarly create the following users
    1. User : ca1; Full Name: Case Allocation ; Password: ca1edu.
    2. User : buyer1; Full Name: Buyer; Password: buyer1edu.
    3. User : ap1; Full Name: Accounts Payable; Password ap1edu.
  2. Create Groups. To create group select User Management à Group Management in the navigation pane.
  3. Click New Group.
  1. In the Create Group window, type Process Assistant Team in the Name field and click Save.
  2. In the Group Management window, type a partial or complete group name as Process Assistant Team in the Select Group to Modify field.
  3. From the list of groups displayed, select the Process Assistant Team group and click on Add Members.
  1.  In the Add Users and Groups window, in the Search for Name field type pa1. You can enter part of the name and the window displays all accounts that match.
  2. Select pa1 from the list and click Add Selected.

  1. Repeat the above steps from 6-12 to create following groups and the members in the groups -
    1. Group Case Allocation Team , Member ca1
    2. Group Buyer Group, Member buyer1
    3. Group Account Payable Team, Member ap1

 

Upload image file

  1. Switch to IBM Process Designer to upload the professional1_example.png image. Go to INVOICE PROCESS à Files then click . Select Web File from the menu. In a New Web File window browse for professional1_example.png  and click Finish.

 

Create Business Object

  1. In the Designer view, click the plus sign (+) next to Data and select Business Object from the list of components.

 

  1. In the New Business Object dialog, enter Invoicein the Name field and click the Finish button.

  1. In the Business Object editor, under the Behavior section, select Complex Structure Type from the Definition Type drop-down list.
  2. In the Parameters section, click the Add button.
  3. In the Parameter Properties section, replace Untitled1 in the Name field with invoiceCode.
  4. Leave the variable type set to String.

 

  1. Repeat steps 4 through 7 to add the following parameters.
    1.   poCode, String
    2. approval, String
    3. dispatchDocsAppended, String
    4. inspectionReportAvailable, String
    5. tinNumber, String
    6. serviceTaxRegNumber, String
    7.   price, Decimal (Note : To change the datatype from default String to Decimal click Select button and select Decimal)
  1. category, String
  2. status, String
  1. The completed business object should look as follows.
  1. Press Ctrl-S to save the changes.
  2. Close the business object editor.

 

Select the Invoice Variable Type in all the process variables

  1. Select Processes under INVOICE PROCESS and then double-click Accounts Payables – Invoice Process from the Business Process Definitions section.
  2. Click the Variables tab.
  1.   Click on Lresponse variable under Output variables.
  1. In the Details section, click Select and select Invoice.
  1. Notice the red cross will be removed after you select Invoice business object.
  2. Go back to the Diagrams tab.
  3.  Repeat the above steps for all the variables in the services of Payables – Invoice Process BPD where the Invoice Business Object has been referred.
    1. Double-click Process Inward Invoice Documents
      1.   Click the Variables tab. Repeat the above steps to reference the Invoice business object for the following variables and press Ctrl-S to save your changes.
        1. Input, Linvoice.
        2. Output, Lresponse
      1.    Close the Scan and Create Invoices service.
    1. Make sure you are in the Accounts Payables – Invoice Process BPD. Double-click the Invoice Returned to Buyer/User service in Buyer/User Department swimlane.
      1.    Click the Variables tab. Repeat the above steps to reference the Invoice business object for the following variables and press Ctrl-S to save your changes.
        1. Input, Linvoice.
        1.   Output, Lresponse
      1. Close the Invoice Returned to User service.
    1. Make sure you are in the Accounts Payables – Invoice Process BPD. Double-click the Perform Duplicate Check service.
  1.  Click the Variables tab. Repeat the above steps to reference the Invoice business object for the following variables and press Ctrl-S to save your changes.
    1. Input, Linvoice.
  2. Close the Perform Invoice Duplicate Check service.
  1. Make sure you are in the Accounts Payables – Invoice Process BPD. Double-click the Reject Invoice service.
  1. Click the Variables tab. Repeat the above steps to reference the Invoice business object for the following variables and press Ctrl-S to save your changes.
    1. Input, Linvoice.
    2. Output, Lresponse
  2. Close the Reject Invoice service.
  1. Make sure you are in the Accounts Payables – Invoice Process BPD. Double-click the Process Payment service.
  1. Click the Variables tab. Repeat the above steps to reference the Invoice business object for the following variables and press Ctrl-S to save your changes.
    1. Input, Linvoice.
    2. Output, Lresponse                                                         
  2.   Close the Initiate Payment service.

 

Select the image in Process Payment coach 

  1. These steps you are performing to link the image control of the coach in Process Payment activity, with the
  2. Select Processes under INVOICE PROCESS and then double-click Accounts Payables – Invoice Process from the Business Process Definitions section.
  3. Double-click Process Payment.
  1. Click the Coaches tab.
  1. Double-click the Pay Invoice coach.

  1. Click the professional1_example.png image control and click the presentation tab in the Properties section below.

  1. Click the Select button and select professional1_example.png from the list.
  2. Press Ctrl-S to save your changes.

Implement Human Service  - CaseAllocation

  1.  If you have closed the Accounts Payables – Invoice Process  BPD, to reopen it, select Processes under INVOICE PROCESS and then double-click Accounts Payables – Invoice Process from the Business Process Definitions section.
  1. Right-click the CaseAllocation activity and select Activity Wizard from the list of options.
  2.  In the Activity Wizard - Setup Activity dialog complete the following and click Next
    1. Select Service Type as Human Service (Service with human interaction).
    2. Select Service Selection as Create a New Service.
    3. Type Allocate Invoice Category in New Service Name field.
  3. In the Activity Wizard - Parameters dialog, choose the existing process variables to use as input and output for this new service. You do not need invoiceValidation process variable for this activity so, click true in the Input and the Output field in front of the invoiceValidation process variable to change the setting to false. Similarly, toggle Lresponse variable input and output to false.
  4. Click the Finish button. The new service is created and attached to the activity. The new service includes a single Coach.
  5. Double-click the Case Allocation activity for which you created the new service using the Activity Wizard.
  6.  The new Allocate Invoice Category human service opens in the Designer and you can see the diagram as shown in the following image:
  7. Click the Coach and see the Properties section below. Change the name in the Name field, from Coach to EnterInvoiceData.
  8. Press Ctrl-S to save your changes.
  9.  Click the Coaches tab and then click the listed EnterInvoiceData component. Because we used the Activity Wizard, the Coach includes a form element for each of the parameters in the Invoice structure as shown in the following image:
  10. Click on the border just above the Invoice title bar. Note the blue border below.
  11. In the properties view at the bottom select Section tab. In the Behavior section increase # of Columns to 2
  12. Drag the Image control from the Controls section in the right navigation menu and drop on the second column.
  13. Select the image control in the second column.
  14. See the Properties tab at the bottom. Click on the Presentation tab.
  15. Click on Select to select professional1_example.png
  16. Press Ctrl-S to save your changes.
  17. Click the OK button and see the Properties tab at the bottom.
  18. Change the Label field in the Button Details section from OK to Allocate Category.
  19. Press Ctrl-S to save your changes.
  20. Click the Diagram tab.
  21. Drag the server script from the right navigation menu to diagram panel on the right of the EnterInvoiceData.
  22. Click the server script activity. See the Properties below and change the name of the activity from Untitled1 to ‘Set Status To Allocated’.
  23. Click the Implementation tab in the Properties section and add the following lines of code

    tw.local.invoice.status = "CaseAllocated";
  24. Wire the entire flow.
    1. Remove the wire from EnterInvoiceData to End.
    2. Wire Start to EnterInvoiceData, To do this select the sequence flow icon  from the right hand palette, wire Start to EnterInvoiceData.
    3. Wire EnterInvoiceData to Set Status to Allocated
    4. Wire Set Status to Allocated to End
  25.  Your diagram should look like below
  1. Select back the Selection Tool .
  2.  Press Ctrl + S to save your changes.
  3. Close the Allocate Invoice Category service.

Implement service – Perform Checks and Measures

  1. Make sure you are in Accounts Payables – Invoice Process  BPD. To create Implementation right-click  Perform Checks and Measures in the System Services lane.
  2. In the Activity Wizard - Setup Activity dialog complete the following -
    1. Select Service Type as System Service.
    2. Select Service Selection as Create a New Service
    3. Type Perform Checks and Measures in New Service Name field.

 
  1.  Click Next.
  2. In the Activity Wizard – Parameters toggle the following
    1. invoiceValidation, Input to false.
    2. Lresponse, Input and Output to false.
    3. Click Finish.


  1. Press Ctrl + S to save your changes.
  2. Double-click Perform Checks and Measures service.
  3. Click on the Diagram tab. Click the Script activity. Change the name of the activity from Script to ‘Set Checks and Measures to  false’.
  4. Type in the following code in the Implementation tab under Properties.
 
tw.local.invoice.status = "InvoiceProcessing";
tw.local.invoiceValidation = new tw.object.InvoiceValidation();
tw.local.invoiceValidation.invoiceChecksMeasures = false;
  1. Select the wire from Set Checks and Measures to  false to End and press Delete.
  2. Drag the Decision Gateway from the right navigation menu to diagram canvas. Rename it from Untitled1 to ValidateInvoice.
  1. Drag and drop 3 Server Script from the right navigation menu to diagram panel. Rename them to Validate Invoice For Case A, Validate Invoice For Case B and Validate Invoice For Case C respectively. Your diagram should look like as shown below –

  1. Press Ctrl + S to save your changes.
  2. Wire the ValidateInvoice  Decision Gateway to the three Server Script activity. Select the sequence flow icon  on the right, click on the ValidateInvoice  node and connect the Server Script in the following sequence. First connect to Case B then Case A and Case C. NOTE: You are connecting in this sequence because as per the functionality if all conditions evaluate to false, the process follows the default sequence line. The default sequence line is the first line that you create from the gateway to a following step. For this sample you need to define Case B as a default sequence line that is why you are connecting this first.
 
  1. Press Ctrl + S to save your changes.
  2. Select the Selection Tool icon  on the right and click on the wire connecting Decision Gateway to each Server Script to rename them to Case A, Case B and Case C respectively from the Properties Panel at the bottom. Check the Name Visible option.

  1. Similarly rename Case B and Case C.
  2. Press Ctrl + S to save your changes.
  3. Click on the ValidateInvoice Decision Gateway. Go to the Properties à Implementation. Select  icon to select  attribute in a input Data for Case A as shown below –
 

 
  1. From the next drop down select == as shown
  1. In the next text box enter “CaseA”.
  2. Similarly repeat steps from 14-16 for “CaseC”. Your configuration should look like below –
  1. Click on Validate Invoice For Case A and go to Properties à Implementation. Enter the following code –
tw.local.invoiceValidation.invoiceChecksMeasures = true;
  1. Click on Validate Invoice For Case C and go to Properties à Implementation. Enter the following code –
tw.local.invoiceValidation.invoiceChecksMeasures = true;
  1. For Validate Invoice For Case B enter the following code –
tw.local.invoiceValidation.invoiceChecksMeasures = false;
  1. Wire the following
    1. Start to Set Checks And Measures To False
    2. Set Checks And Measures To False to ValidateInvoice
    3. Validate Invoice For Case A to End
    4. Validate Invoice For Case B to End
    5. Validate Invoice For Case C to End
        Your diagram should look as shown below-
  1. Press Ctrl + S to save your changes

 

Create Participant Group

  1. To create participant group from the left side navigation panel select INVOICE PROCESSs à Processes then click . Select Participant Group from the menu.
  1. Enter “Process Assistant Team” as a name of a group. Click Finish.
  2. Under Members section select Standard Members and click Add user. Enter pa1
  3. Press Ctrl + S to save your changes.
  4.  Repeat steps 1-4 to add following participant group
    1. Group Case Allocation Team , User ca1, press Ctrl + S to save your changes. Close the editor.
    2. Group Buyer Group, User buyer1, press Ctrl + S to save your changes. Close the editor.
    3. Group Account Payable Team, User ap1, press Ctrl + S to save your changes. Close the editor.
  1. Observe the four participant groups you have created just now.

 

Allocate Participant groups to lanes

  1. Open the Accounts Payables – Invoice Process  BPD.
  2. Select the Inward Process Team lane.
  1. In the Properties section below click Select to assign the Default Lane Participant Group to Process Assistant Team.
  1. Press Ctrl + S to save your changes.
  2. Similarly allocate the following swimlanes to corresponding participant group:
    1. Swimlane – Case Allocation Team, Group - Case Allocation Team.
    2. Swimlane – Buyer/User Department, Group - Buyer.
    3. Swimlane – Accounts Payables, Group – Account Payable Team.
    4. Press Ctrl + S to save your changes.

  Complete the Accounts Payables – Invoice Process  BPD

  1. Drag and drop Decision Gateway from the palette in between Perform Checks And Measures and Perform Duplicate Check on the diagram canvas. Rename it to Is Invoice Valid ?
  1. Select the sequence flow icon  on the right, click on the Is Invoice Valid ? and connect the Perform Duplicate Check.
  2. Select back the Selection Tool icon  from the palette, and then select the  wire  Is Invoice Valid ? to  Perform Duplicate Check. Change the following under Properties of Decision Gateway.
    1. Rename the wire to SUCCESS.
    2. Check the Name Visible option.
 
  1. Your diagram should like following:
  1. Click on the Is Invoice Valid ? and connect the Invoice Returned to Buyer/User. Rename the wire to FAILED. Your diagram should like following:
  1. Press Ctrl + S to save your changes.
  2. Click the Is Invoice Valid ? decision gateway and click the Implementation tab under Properties.
  3. In the Decisions section select  icon as shown below and then select invoiceValidation(InvoiceValidation) à invoiceChecksMeasures(Boolean)

 
  1. From the next drop down select == as shown
  1. In the next text box enter false.
  2. Your completed decision gateway configuration should look like following –
  1. Press Ctrl + S to save your changes.
  2. Wire the following services of BPD-
    1. Case Allocation to Perform Checks and Measures.
    2. Perform Checks and Measures to Is Invoice Valid?
    3. Invoice Returned to Buyer/User dept to Case Allocation.
  3. Press Ctrl + S to save your changes.
  4. The complete BPD process should look like following:


The process application is completed now. Switch to the Run the samples section for the instructions on how to run and test the process.