Using Case Data to Open Work Lists From Business Services Using Custom Clients

In TIBCO ActiveMatrix BPM, you can specify case data in a business service and open a work item list that belongs to the specified case data. If required, you can use this feature in your custom client. This feature is provided as a component of the BPM Web Client API.

TIBCO ActiveMatrix BPM allows you to use the case reference of the case data in a business service. You can then display a list of work items that are associated with the specified case reference. You can perform all the usual functions on the work items in the list in the normal way. For example, open, allocate, filter or sort work items. See TIBCO ActiveMatrix BPM Client Developer API Guide for more information.

Note: When a business service is run and a work list displayed, it is not the work list of the currently logged in user. The work items in the work item list belong to the specified case data. This means that some of the work items cannot be opened as only the work items that are owned by the currently logged in user can be opened. You need to login as a user that has the ViewWorkList system action assigned to it to view the work-items.

This feature is provided as a component of the BPM Web Client API. See TIBCO ActiveMatrix BPM Client Developer API Guide for more information about the BPM Web Client API. Using TIBCO Business Studio, you can develop web clients to be used with TIBCO ActiveMatrix BPM using the Web Client API. TIBCO Business Studio uses Google Web Toolkit (GWT) that in turn uses the BPM Web Client API to access the BPM runtime services.

The BPM Web Client API provides an API called webCompRunner. There are three methods that the webCompRunner API provides:

  • The initialize method loads the client script and informs your custom client that the component is ready to be used.
  • The load method loads the work item list associated with the case reference.
  • The unload method provides any cleaning up and also allows you to load another work item list associated with a different case reference, if required.
  • The update_case_reference method allows you to pass a new case reference.

Prerequisites

  • To use this feature, you must have selected the Openspace Gadget Development installation profile when installing TIBCO Business Studio. The Openspace Gadget Development installation profile is available when you select Customize Installation during installation. See TIBCO Business Studio Installation Guide.
  • The BPM Web Client API is provided as two jar files which are installed when you install the BPM runtime at TIBCO_HOME\client-api\n.n\web-client-api where n.n is the version of TIBCO ActiveMatrix BPM that you are using. For example, C:\Program Files\tibco\amx-bpm\client-api\3.0\web-client-api. The jar files are:
    • bpm-web-client-api-1.4.jar
    • bpm-web-client-dep-1.4.jar
      • Copy both the jar files to a folder which is on the machine hosting your development environment.
      • Edit the CLASSPATH to ensure that all the binary contents of the archive file are in the CLASSPATH. For example, add all the files available in C:\temp\web-client-api to the CLASSPATH.
  • If you want to use TIBCO Forms in your in custom client, you must import the formsclient.nocache.js file into your web application project and include a script tag that points to this file. This provides the TIBCO Forms library. See TIBCO Forms User's Guide for more information about TIBCO Forms.
  • On your hosting page, you need to have a reference to the webcomponentclient.jsfile.
  • If you are developing a GWT app, you need to inherit the BPM web client API module.

Procedure

  1. From TIBCO Business Studio, create your new BPM web application project. See TIBCO ActiveMatrix BPM Client Developer API Guide for more information.
  2. Create and develop your gadget. See TIBCO ActiveMatrix BPM Client Developer API Guide for more information.
  3. If you want your custom client to use TIBCO Forms, then you must import the formsclient.nocache.js into your web application project.
  4. Once you have imported the formsclient.nocache.js file into your project, you must include a script tag in the doctype html file in your custom client, as shown below:
    <!doctype html>
    <html lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Openspace App Contribution</title>
    <script type="text/javascript" language="javascript" src="bpmresources/formsclient/formsclient.nocache.js"></script>
    <link type="text/css" rel="stylesheet" href="gadget.css">
    </head>
    <body>
    	<!-- OPTIONAL: include this if you want history support -->
    	<iframe id="__gwt_historyFrame" tabindex="-1"
    		style="position: absolute; width: 0; height: 0; border: 0"></iframe>
    </body>
    </html>
  5. Use the initialize method to load the client script. The client script has to be loaded successfully for the initialize method to work. You need to use the callBackHandler provided by the BPM web client API to perform any further initialization. Any further initialization should be performed after the successful loading of the BPM Web Client API script.
    For example:
    WebCompRunner.setLoadReadyCallbackHandler (new LoadReadyCallbackHandler ()
  6. The Load method loads the work item list associated with the specified case reference. The Load method has three arguments:
    • WORK_LIST_CASE_REFERENCE. The case reference of the case data.
    • The DOM Id. The location where the work item list should be loaded.
    • The BPM Web Client API class parameters. These are the parameters you can pass when loading the BPM Web Client API. The class parameters are:
      • WebCompCallBackHandler. The WebCompCallBackHandler notifies the BPM Web Client API that the BPM Web Client API class has loaded successfully or failed with an error.
      • webCompCaseRef. The webCompCaseRef identifies the case reference whose list of work items you want to view.
    For example:
    WebCompRunner.loadComponent(WebCompType.WORK_LIST_CASE_REF, "WORK_LIST_CASE_REF.parent.element.id".,
    webCompLoadParams, hew WebCompLoadCallbackHandler()
  7. On the successful loading of the BPM Web Client API , you can call the Unload method. You can use this method to perform any required clean up. You can also use this method to call a new work item list for a new case reference. You can do this by passing a new case reference in the webClientComponent UPDATE_CASE_REF parameter.
    For example:
    webCompCaseRef.setUnloadCallbackHanlder (new UnloadCallbackHandler()
  8. Deploy the process as normal. See TIBCO Business Studio BPM Implementation Guide for more information.
  9. From your custom client, start the business service. Once you have entered the case reference, the work item list displays.
    From this, you can perform all the functions that you can perform on a normal work item list. See TIBCO ActiveMatrix BPM Client Developer API Guide for more information.