Contents


Overview

Skill Level: Beginner

We will use BPM to create a service that iterates through all items in a task queue without returning to the Process Center

Ingredients

  • IBM BPM
  • Dashboard Toolkit (should come with your IBM BPM)
  • 1 BPD
  • 3 Human Services
  • 2 General System Services

Step-by-step

  1. Install the Dashboard Toolkit

    Inside IBM BPM create a new process app in the process center. Click toolkits and ensure the dashboards TK is in the toolkits bar on the left. You may need to click toolkits and the plus to attach the dashboard toolkit.

  2. BPD Set Up

    • Create a BPD with two lanes. 
    • Set both of type all users and ensure that the lower lane is not a system lane
    • Set the first lane called Submit, and the second called Review,
    • add a private variable = taskTitle (string)
  3. Human Service Initial Set Up

    • Drop two human services, one titled HS Submit and one titled HS Review, each in their own lanes.
    • In HS Submit have one output variable – taskTitle (String)
    • In HS Review have one input variable – taskTitle (String)
    • In HS Submit go into the coach, drop one text box and bind it to taskTitle
    • In HS Review drop one text box, bind it to the task title
    • Create a third Human Service unconnected to the BPD called Loop Review
    • Loop Review will have 2 private variables, taskTitle (string) and taskID (string)
    • Set Loop Review to be a startable service in its options
  4. General System Service Creation

    • Create a General Systems Service called Grab Highest Priority Task And Accept
    • Output Variables to be created will be taskTitle and taskID both of type String
    • Drop two scripts into the GSS
    • Call the first script Grab and Assign Next Task
    • Insert this as the code
    • GSS-Script-Get-Task
    • Call the second script inside this GSS Retrieve Business Data
    • In the second script put this one line of JavaScript
      • tw.local.taskTitle = tw.system.findTaskByID(tw.local.taskID).processInstance.businessData.valueArray()[0];

     

  5. General Systems Service Creation Part Two

    • Call the second General Systems Service  Complete Task
    • Inputs into this GSS will be taskID
    • Drop a box of script into the Service and insert this code into it
      • var outputValues = new tw.object.Map();
        tw.system.findTaskByID(tw.local.taskID).complete(tw.system.user, outputValues);
  6. Process Completion

    • Ensure that all bindings are correct
    • All GSS's connect start to Javascript(s) to end node
    • All data mapping is correct at the process level
    • All data mapping is correct at the GSS level
    • All human services have correct binding and mapping if necessary
    • The BPD Connects to HS Submit then HS Review then the end node

    BPD-Screen

    • Congratulations! The Service is set up!
  7. Testing

    NOTE

    • If you have tasks inside your queue that are not from the process we just created it will cause errors as it pulls any task from the task log, not just ones specific to this process
    • If you run the Review Loop it will sometimes not grab a new task as the tasklog takes a few seconds to update and spread changes, you may want to write some code to check to make sure that you actually are pulling the next highest priority task (that is not the one you just completed)

     

    How To Test

    • Launch a few instances of your BPD but don't proceed after you initially submit your tasks
    • Click the startable system service and see if it pulls the correct information

    Things to try yourself!

    • Set up logic to catch if there are no more tasks to pull
    • Set up logic to only pull tasks of the correct type for your process

Join The Discussion