You are on page 1of 38

Creating Case Custom Workbench Pages in

IBM Case Manager 5.2

Bob Jackson
rej@us.ibm.com
Creating Case Custom Workbench Pages in IBM Case Manager 5.2

Table of Contents
ILLUSTRATION INDEX........................................................................................................2
INDEX OF TABLES..............................................................................................................4
1. CREDITS 5
2. INTRODUCTION.............................................................................................................5
3. TARGET AUDIENCE.........................................................................................................7
4. CONVENTIONS..............................................................................................................7
4.1. ERRORS AND/OR SUGGESTIONS......................................................................................7
4.2. FORMATTING.........................................................................................................8
4.3. PREFERRED PRACTICES..............................................................................................9
5. PROCESS OVERVIEW....................................................................................................10
6. CONFIGURE QUEUES....................................................................................................11
6.1. INSTRUCTIONS......................................................................................................11
7. CREATE CASE PROPERTY FOR CASE FILTERING..............................................................14
7.1. OVERVIEW..........................................................................................................14
7.2. INSTRUCTIONS......................................................................................................14
8. CREATE CASE WORKBENCH PAGE.................................................................................15
8.1. OVERVIEW..........................................................................................................15
8.2. INSTRUCTIONS......................................................................................................15
9. CREATE FILTER IN-BASKET SA WIDGET..........................................................................16
9.1. OVERVIEW..........................................................................................................16
9.2. INSTRUCTIONS......................................................................................................16
9.3. FILTER INBASKET SA SOURCE CODE..............................................................................18
9.4. HOW IT WORKS...................................................................................................21
10. CREATE FILTER SEARCH SA WIDGET............................................................................21
10.1. OVERVIEW........................................................................................................21
10.2. INSTRUCTIONS....................................................................................................21
10.3. FILTER SEARCH SA SOURCE....................................................................................25
10.4. HOW IT WORKS.................................................................................................30
APPENDIX A:DISCLAIMER OF WARRANTIES.......................................................................31
APPENDIX B:NOTICES......................................................................................................32
APPENDIX C:TRADEMARKS AND COPYRIGHTS...................................................................33

Page 2 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
Illustration Index

Illustration Index
Illustration 2.1: Sample Case Workbench..........................................................................................6
Illustration 6.1: Open Soution in Process Designer..........................................................................12
Illustration 6.2: Select Case Type and Workflow..............................................................................12
Illustration 6.3: Create Inbasket Filter..............................................................................................13
Illustration 7.1: Add Agent Case Property........................................................................................14
Illustration 9.1: Filter Inbasket Wiring...............................................................................................17
Illustration 9.2: Filter Inbasket Wiring...............................................................................................17
Illustration 10.1: Filter Search SA Wiring..........................................................................................23
Illustration 10.2: Case List Widget Wiring........................................................................................24
Illustration 10.3: Search Broadcasting Disabled...............................................................................25

Page 3 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
1. Credits

1. Credits
Chandira Kuma and Pat Sort De Sanz both provided valuable input and served as sounding
boards. Chandira tested the procedure and found several areas for improvement. Pat guided me on
how to write this kind of tutorial and provided moral support.
Dave Perman's blog entries on Developer Works. In particular, this entry
https://www.ibm.com/developerworks/community/blogs/e8206aad-10e2-4c49-b00c-fee572815374/?
lang=en was used as the basis for some of the code in this document.
Jos Olminkhof is the author and maintainer of the Auto Claims sample solution used as a test case
for this tutorial. It can be downloaded from http://www.ibm.com/developerworks/data/tutorials/dm-
1101casemanagertemplates2/.
Xiao Ji Tian in the IBM development labs helped troubleshoot an issue with setting multiple filters
on the same queue. He was instrumental in getting the issue incorporated into a fix pack.

Page 4 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
2. Introduction

2. Introduction
When a user logs into ICM, they are presented with two tabs: Work and Cases. The Work page
shows the work in-baskets. This is how they access activites assigned for their action. The Cases
page allows users search for cases based on case properties. This configuration provides a work item
oriented view of case management.
While work items are assigned to users, by default, case manager does not implement case
ownership. In situations where all, or part, of a case is owned by users, the simple configuration of the
case described in this tutorial can be used to set up case workbenches. From the workbench, the
viewers access their assigned cases and the associated work. The case workbench page can be set
upo to display all the assigned work items and those associated with user queues. This is a case
oriented view that can be set up for many use cases. For example, this configuration could be used to
set up management and supervisory pages allowing these people to view not only the open cases but

Illustration 2.1: Sample Case Workbench

to see the active activites associated with them.

To make this work, you will need a case property that denotes some form of case ownership or other
association. The case owner has overall responsibility for all of the activities associated with a given
case. While the other sections in this manual can be implemented using virtually any solution, this
section describes how it is done using the Auto Claims Solution because it is readily available for
download from Developer Works.

Page 5 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
2. Introduction

For the custom page, we implement two Script Adapters: Filter Search SA and Filter
Inbasket SA. When wired between the Case Search widget and the Case List widget, the
Filter Search SA widget modifies the search query so that only active cases for the current user
are presented. An administrators case view could be created that shows the active cases for a list
of specific users instead of the currently logged in user. Such a configuration would require a more
complex setup.

While it could be removed, we leave the search widget in place for this example.
This allows the user to further refine their case workbench view. It can be removed should
you desire.

When this page is properly configured, it only displays cases for the currenlty logged
in user. Therefore, make sure that you have at least one active case for the ID that
you are testing.

IBM Case Manager(ICM) version 5.2 introduced a new user interface platform based on IBM
Content Navigator technology. It retained the same concepts of page design and layout using
reusable widgets. A combination of the included widgets and included generic Script Adapter
widget is used to create the customized workbench page. While the technique used for the
customization described in this document provides a custom workbench based on a given user's
association with a case, the techniques can be used to create workbench pages based on any case
property.
Below is an illustration of the target page. For our scenario, we have a user who is assigned to
work on a set of cases. The case property Agent is used to to diferentiate which user is
repsonsible for a given case. When the case list widget is populated, it will only display cases where
the current user is assigned on the Agent property.
When the user first selects the page, only two widgets are visible: the Case Search widget and
the Case List widget. When the user selects a case, the Case Information widget appears
along with the Inbasket widget. The Case Information displays the summary information
about the selected case, while the inbasket widget displays active activity steps assigned to
users for that case.
For the configuration we are building, only the minimal modifications are being made. For this
configuration, the following Widgets are required: Case List, and In-Baskets. The Case
Information and the Case Search widgets are optional.

Page 6 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
3. Target Audience

3. Target Audience
This document is intended for use by experienced IBM Case Manager administrators. The user must
have experience with both the IBM Case Manager Builder application and with the IBM FileNet
Process Designer tool. Also, an understanding of ICM events is helpful should you wish to modify the
behavior of the end result.

Page 7 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
4. Conventions

4. Conventions
4.1. Errors and/or Suggestions
Please email any feedback, errors, or problems with this document to Bob Jackson rej@us.ibm.com

4.2. Formatting
The following symbols and formatting appear in this document.

Table 4.1: Formatting Styles Used

Page 8 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
4. Conventions

Term Description
ICM IBM Case Manager

payload A payload is an object that is passed from, or


received by, a widget when an event happens in
the system. Most payloads are JSON objects. But
a payload can be a simple string.

SA Acronym for Script Adapter

Script Adapter A script adapter is a special widget that the user


can place on a page. The user places JavaScript
in the widget that will execute when it is called.
Script Adapters are wired to other widgets. While
widgets can receive events that are broadcast.
Script adapters only receive events from the
widgets to which they are wired.
Table 4.2: Terminology and Acronyms

4.3. Preferred Practices


FireFox Preferred FireFox works the best with ICM. If you are customizing what the
browser presents, it is best to use the same browser when you are
demonstrating. If you have to demonstrate in Internet Explorer(for
example to show workbench objects), you need to take into account
the fact that IE interprets the JavaScript differently. Also, Firebug is
very helpful when you are modifying the JavaScript. It only runs in
FireFox.

Always Create New When you wish to customize a page, it is always best to create a new
Pages page by copying a working page. You then modify the new page. This
allows you to revert back to the out-of-the-box configuration with
minimal effort.

Script Adapter Naming Append SA to the end of your script adapter name to make it easier to
find in the console log.

Page 9 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
4. Conventions

Table 4.3: Preferred Practices

Page 10 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
5. Process Overview

5. Process Overview
The steps necessary for creating the Case Workbench page are:
_____0. Configure a filter for F_CaseFolder on the in-baskets that will be displayed on the
workbench.
_____1. Copy default Cases Solution page to create the workbench page.
_____2. Edit the new workbench page.
___ A. Drag In-baskets widget onto the new page.
___ B. Disable Search event broadcasting.
___ C. Create Filter Inbaskets SA script adapter.
___ D. Create Filter Search SA script adapter.
___ E. Wire the script adapters.
___ F. Wire Case List widget to Inbaskets to trigger refresh.
_____3. Assign the page to the role(s) where it is used.
_____4. Save and Close the solution.
_____5. Deploy the solution.
_____6. Test the result.

The instructions in this document are for configuring the Auto Claims demonstration
available at http://www.ibm.com/developerworks/data/tutorials/dm-
1101casemanagertemplates2/. These instructions can be modified for other use
cases.

Page 11 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
6. Configure Queues

6. Configure Queues
6.1. Instructions
_____0. Log into Case Builder.

Illustration 6.1: Open Soution in Process Designer

_____1. Start Process Designer from the Solution.

_____2. Select the case type and any of the Task Workflows.

Illustration 6.2: Select Case Type and Workflow

When you edit the queue configuration, it applies to all case types for the solution
because the role and queue configuration is shared across the entire solution.

_____3. View Configuration


_____4. Apply the in-basket filter to each in-basket as shown in the illustration Create
Inbasket Filter as folllows:

Page 12 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
6. Configure Queues

___ A. Right Click on the Inbox queue and select properties.


___ B. Select Inbaskets
___ C. Select the All Assigned Work in-basket (AC_All Assigned Work).
___ D. Select Create Filters.
___ E. Configure F_CaseFolder as a filter.

___ A.
___ B. icon to display the Avaliable
Fields menu.
___ C. Check the box next to Show system fields.
___ D. Scroll down and select F_CaseFolder (Guid).
___ E. Click the OK button.
___ F. Rename the filter by double clicking in the Name column and
typing F_CaseFolder. The Label in UI column should
automatically update to match the Name column. If not double
click in that column and type F_CaseFolder.
___ G. Click the OK button.
_____5. Repeat this sequence for all other queue and in-basket combinations that you wish to
display on your page.

Page 13 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
6. Configure Queues

Illustration 6.3: Create Inbasket Filter

_____6. File Solution Save and Close

While the instructions are for inbaskets associated with the system Inbox queue,
these filters can also be configured for the queues associated with the various
roles. You can also copy or create additional in-baskets from this interface.

Page 14 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
7. Create Case Property for Case Filtering

7. Create Case Property for Case Filtering


7.1. Overview
A case property is needed for the case workbench filter. We are going to use the existing Agent role
for the page display. In order to set up the page, we need a case property, so we will create an Agent
case property.

7.2. Instructions
_____0. Log in to the ICM Builder application as an administrative user.
_____1. Edit your solution.

Illustration 7.1: Add Agent Case Property

_____2. Add a case property Agent as a single value string as shown below.

_____3. Assign the property to each applicable case type.

Page 15 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
8. Create Case Workbench Page

8. Create Case Workbench Page


8.1. Overview
The workbench page is a customized version of the included Cases search page. In this section,
we will copy the default Cases page layout and modify it to suit our needs.

8.2. Instructions
Create, name and lay out the workbench page as follows:
_____0. Log in to the ICM Builder application as an administrative user.
_____1. Edit your solution.
_____2. Determine which case property you will use to filter the page. If it doesn't exist,
create it on the Properties page. Edit Properties
_____3. Navigate to the solution pages for your solution: Pages Solution Pages.
_____4. Hover the mouse over the Cases page name, then select the copy icon on the right
side of the screen.
_____5. In the resulting screen, type the name of your new page: My Cases and click OK to
create the copy.
_____6. Select the My Cases page to edit it in the page designer.
_____7. Drag the In-baskets Widget from the pallet on the left onto the page.
_____8.
_____9. Check the box next to Do not populate the in-basket until the dynamic
filter is received.
_____10. OK

Activating the o not populate the in-basket until the dynamic filter is
received setting delays the in-baskets display until the dynamic filter, that is configured
later, is received.
_____11. Save your work by clicking Save.

Page 16 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
9. Create Filter In-Basket SA Widget

9. Create Filter In-Basket SA Widget


9.1. Overview
The filter In-Basket SA filters the information presented in user's in-baskets. We configure the in-
baskets widget as hidden until the filters are received. That way the user only sees work related to the
selected case.
For the case workbench page in this example, we only want to display the Activity work items for
selected case. That is accomplished by filtering the in-baskets using the case folder GUID. Because
Case Builder doesn't provide the ability to configure the Case Folder GUID as a In-basket filter, we
configure the filter using Process Designer.

9.2. Instructions
The instructions in this section continue from the previous section.
_____0. Drag a Script Adapter into the Hidden area on the page.
_____1. Rename the Script Adapter Filter In-Basket SA.
_____2.
_____3. Copy the widget source code from the 5.3. Source section into the widget editor.
_____4. In the beginning of the source code, there is a configuration block as shown below.
Make the required changes to the source code. You need to set up the queueName
and inbasketName variables similar to match your environment. By default, the solution
prefix is a prefix for all personal in-baskets (the Inbox queue). In contrast, the prefix is
used for defining shared queues but no prefix is used for in-baskets in the shared
queues.
/*
* Begin Configuration Block
*/

/*
* inbasketNames is passed to the inbasket search. You need to create a filter
* for each combination of queueName and inbasketName. Do not provide the
* solution prefix. Use the format shown in the below JSON. Where there it does
* not apply, do not include the solution prefix or the "_".
*/
var inbasketNames = [ {
"queueName" : "Inbox",
"inbasketName" : solutionPrefix + "_" + "All Assigned Work"
}, {
"queueName" : solutionPrefix + "_" + "Agent",
"inbasketName" : "Agent"
}, {
"queueName" : solutionPrefix + "_" + "CSR",
"inbasketName" : "CSR"
} ];

Page 17 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
9. Create Filter In-Basket SA Widget

This example shows filtering three different queues. Early versions of ICM 5.2 did not
allow for multiple filters on the same queue. If you attempt to apply multiple filters
on the same queue and receive an error message when you select a case in the
case list widget. You may have encountered the defect. The releated defects were:
77903 Dynamic filter failed when the passing payload include several inbaskets in
one queue and 78169 - Dynamic filter can not work when the Inbasket is render after
the event sending. They have been corrected in a a fix pack that you will have to

Illustration 9.1:
9.2: Filter Inbasket Wiring

load in order to have multiple filters on the same queue.


_____5. Wire the widget. The configuration block has a JSON variable that describes the
default wiring. The wiring is also shown in the illustration Filter Inbasket Wiring .
_____6. Click Save to save your work.

Page 18 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
9. Create Filter In-Basket SA Widget

9.3. Filter Inbasket SA Source Code

When copying and pasting, hidden control characters are sometimes captured. Those
hidden characters could cause problems when the code executes. First, copy the code
to a text editor, Eclipse, or IBM Rational Application Developer. In the editor, remove
the hidden characters. Then, copy and paste the edited code into the script adapter.
Otherwise, copy and paste in sections ending prior to each page break to avoid the
control characters.

Copy and paste the below text into the script adapter.
/*
* @author Bob Jackson rej@us.ibm.com Written 2014-03-04
* @description: Filter InBasket SA.js Filter the inbasket to only return items for the specified
case. SVN Id : $Id: Filter In-basket SA.js 94 2014-06-05 18:13:38Z rej $ SVN URL : $HeadURL:
https://rej/repos/java/Case%20Workbench%20Page%20Script%20Adapters/Filter%20In-basket%20SA.js $
*
* SVN URL : $HeadURL: https://rej/repos/java/Case%20Workbench%20Page%20Script%20Adapters/Filter
%20In-basket%20SA.js $
* SVN Revision : $Revision: 94 $
* SVN Id : $Id: Filter In-basket SA.js 94 2014-06-05 18:13:38Z rej $
* SVN Date : $Date: 2014-06-05 14:13:38 -0400 (Thu, 05 Jun 2014) $
* SVN Author : $Author: rej $
*
* DISCLAIMER OF WARRANTIES. This is sample code created by IBM Corporation. IBM
* grants you a nonexclusive copyright license to use this sample code example
* to generate similar function tailored to your own specific needs. This sample
* code is not part of any standard IBM product and is provided to you solely
* for the purpose of assisting you in the development of your applications.
* This example has not been thoroughly tested under all conditions. IBM,
* therefore cannot guarantee nor may you imply reliability, serviceability, or
* function of these programs. The code is provided "AS IS", without warranty of
* any kind. IBM shall not be liable for any damages arising out of your or any
* other parties use of the sample code, even if IBM has been advised of the
* possibility of such damages. If you do not agree with these terms, do not use
* the sample code.
*
* Licensed Materials - Property of IBM
*
* \u0040 Copyright IBM Corp. 2008-2012 All Rights Reserved.
*
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*
* The source code for this program is not published or otherwise divested of
* its trade secrets, irrespective of what has been deposited with the U.S.
* Copyright Office.
*
*/
console.log(this.name, ":Start");
console.debug(this.name, ":Start");

/*
* solutionPrefix is used to insure that the code will work if the solution is
* copied to a solution with a different prefix. Avoid hard coding the prefix

Page 19 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
9. Create Filter In-Basket SA Widget

* into widget code.


*/
var solutionPrefix = this.solution.getPrefix();

console.debug(this.name, "solutionPrefix=", solutionPrefix);

/*
* Begin Configuration Block
*/
/*
* inbasketNames is passed to the inbasket search. You need to create a filter
* for each combination of queueName and inbasketName. Do not provide the
* solution prefix. Use the format shown in the below JSON. Where there it does
* not apply, do not include the solution prefix or the "_".
*/
var inbasketNames = [ {
"queueName" : "Inbox",
"inbasketName" : solutionPrefix + "_" + "All Assigned Work"
}, {
"queueName" : solutionPrefix + "_" + "Agent",
"inbasketName" : "Agent"
}, {
"queueName" : solutionPrefix + "_" + "CSR",
"inbasketName" : "CSR"
} ];

/*
* Wiring Information Incoming Events Source Event Target Event Outgoing Events
* Source Event Target Event
*
* Incoming EventsSearch Search cases Filter Search SA Receive event payload
*/
var eventWiring = {
"Incoming Events" : [ {
"Source" : "Case List",
"Event" : "Select case",
"Target" : this.name,
"Event" : "Receive Event payload",
"Comment" : "Populates the Case List on page load."
}, ],
"Outgoing Events" : [ {
"Source" : "Filter Inbasket SA",
"Event" : "Send event payload",
"Target" : "In-Baskets",
"Event" : "Apply Filter",
"Comment" : "Apply filter"

}, {
"Source" : "Filter Inbasket SA",
"Event" : "Send event payload",
"Target" : "In-Baskets",
"Event" : "Refresh",
"Comment" : "Causes in-basket to refresh and stay current."

}, ]
};
console.debug(this.name, ": Event Wiring", eventWiring);

/*
* End Configuration Block. Do not modify anything after this point.

Page 20 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
9. Create Filter In-Basket SA Widget

*/

/*
* For each inbasket, we need to create model data, then push it onto the model
* array.
*/
var modelArray = [];

console.debug(this.name, "payload=", payload);


/*
* Loop through the array of inbasketNames and to create the filters from the
* array in the configuration block.
*
*/
for (var i = 0; i < inbasketNames.length; i++) {
var data = {
"queueName" : inbasketNames[i].queueName,
"inbasketName" : inbasketNames[i].inbasketName,
"hideFilterUI" : false,
"queryFilter" : "(F_CaseFolder = :A)",
"queryFields" : [ {
"name" : "F_CaseFolder",
"type" : "xs:guid",
"value" : "{" + payload.caseEditable.id + "}"
} ],
"hideLockedByOther" : false
};
console.debug(this.name, "data:", data);

var model = icm.model.InbasketDynamicFilter.fromJSON(data);

console.debug(this.name, "model:", model);


modelArray.push(model);
console.debug(this.name, "modelArray:", modelArray);
}

console.debug(this.name, "Returning the filter");

/*
* The below return statement yields the error "Cannot return outside a
* function" in Eclipse. Ignore the error. The script adapter provides the
* proper function environment.
*/
return {
"dynamicFilters" : modelArray
};
console.log(this.name, "End");
console.debug(this.name, "End");

By default, this code writes to the console when it starts and ends(console.log). This
information is visible in the FireFox debugger and in Firebug. The console.debug
statements cause additional output when &debug=true is appended to the page URL.

Page 21 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
9. Create Filter In-Basket SA Widget

9.4. How it Works


When the user selects a case in the Case List widget, a payload is sent to Filter Inbaskets SA that
includes the GUID of the selected case. Filter Inbaskets SA processes the payload and sends a
filter payload to the in-basket widget. This filter insures that only activity steps related to the
selected case are displayed.
Each in-basket and queue is configured separately. Hence the configuration block must be
configured for each solution.
In-basket filters can be created for any case property, for example to display work items filtered
by user ID.

Page 22 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
10. Create Filter Search SA Widget

10. Create Filter Search SA Widget


10.1. Overview
The Filter Search SA widget insures that only cases where a specific case property is configured are
displayed. For this example, we are filtering the search page so that the user ID of the current user is
assigned to the case and it is an active case.

10.2. Instructions
_____0. Edit the Case Workbench Page.
_____1. Drag a new Script Adapter widget to the hidden area and rename it Filter Search
SA.
_____2. Insert the code in the next section 8.3. Source into the widget.
_____3. Configure the widget by editing the configuration block in the source code. An excerpt is
included below.
/*
* Begin Configuration Block
*/

/*
* The specific case type we are searching against.
*
* Specify the specific case type without the prefix. You will get the Summary
* view properties in the columns. If you use "", you will get all case types,
* but only the default columns will display.
*/

var myCaseType = "GeneralClaim";

/*
* The case property which is matched against the logged in user ID without the
* prefix.
*/
var myCaseProperty = "Agent";
/*
* The display name of the case property which is matched against the logged in
* user ID.
*/
var myCasePropertyName = "Agent";

/*
* Wiring Information Incoming Events Source Event Target Event Outgoing Events
* Source Event Target Event
*
* Incoming EventsSearch Search cases Filter Search SA Receive event payload
*/
var eventWiring = {
"Incoming Events" : [ {
"Source" : "Page Container",
"Event" : "Page Opened",
"Target" : this.name,
"Event" : "Receive Event payload",

Page 23 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
10. Create Filter Search SA Widget

"Comment" : "Populates the Case List on page load."


}, {
"Source" : "Search",
"Event" : "Search cases",
"Target" : this.name,
"Event" : "Receive Event payload",
"Comment" : "Recieves search payload from search widget."
}, ],
"Outgoing Events" : [ {
"Source" : "None Required",
"Event" : "None Required",
"Target" : "None Required",
"Event" : "None Required",
"Comment" : "None Required"

}, ]
};
console.debug(this.name, ": Required Wiring", eventWiring);

/*
* End Configuration Block. Nothing below this point should need modification.
*/
_____4. Wire the widget as described in the source code variable eventWiring which is shown
below. If you decide to remove the search widget from the page, you do not wire the
case search event.

Illustration 10.1: Filter Search SA Wiring

Page 24 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
10. Create Filter Search SA Widget

_____5. Modify the Case List widget wiring adding the event to refresh the inbaskets as shown

Illustration 10.2: Case List Widget Wiring

below.

_____6. Disable Broadcasting from the Search widget by unchecking the box for the
ibm.SearchCases event as shown below.

Page 25 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
10. Create Filter Search SA Widget

Illustration 10.3: Search Broadcasting Disabled

10.3. Filter Search SA Source

When copying and pasting, hidden control characters are sometimes captured.
Those hidden characters could cause problems when the code executes. First, copy
the code to a text editor, Eclipse, or IBM Rational Application Developer. In the
editor, remove the hidden characters. Then, copy and paste the edited code into the
script adapter. Otherwise, copy and paste in sections ending prior to each page
break to avoid the control characters.

Copy and paste the below text into the script adapter. Slight performance enhancements can be
had by removing the comments and compacting the script adapter code.
/*
* @author Bob Jackson rej@us.ibm.com
* @description: Filter Search SA.js retrieves the currently logged in user and search for the
working cases where that user is the specified case property. This relies on code posted by Dave
Perman to the ECM Developerworks blog at
https://www.ibm.com/developerworks/community/blogs/e8206aad-10e2-4c49-b00c-fee572815374/?lang=en
SVN Id : $Id: Filter Search SA.js 94 2014-06-05 18:13:38Z rej $ SVN URL : $HeadURL:
https://rej/repos/java/Case%20Workbench%20Page%20Script%20Adapters/Filter%20Search%20SA.js $
*

Page 26 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
10. Create Filter Search SA Widget

* SVN URL : $HeadURL: https://rej/repos/java/Case%20Workbench%20Page%20Script%20Adapters/Filter


%20Search%20SA.js $
* SVN Revision : $Revision: 94 $
* SVN Id : $Id: Filter Search SA.js 94 2014-06-05 18:13:38Z rej $
* SVN Date : $Date: 2014-06-05 14:13:38 -0400 (Thu, 05 Jun 2014) $
* SVN Author : $Author: rej $
*
* DISCLAIMER OF WARRANTIES.
* This is sample code created by IBM Corporation.
* IBM grants you a nonexclusive copyright license to use this sample code example to generate
similar function tailored to your own specific needs.
* This sample code is not part of any standard IBM product and is provided to you solely for the
purpose of assisting you in the development of your applications.
* This example has not been thoroughly tested under all conditions.
* IBM, therefore cannot guarantee nor may you imply reliability, serviceability, or function of
these programs.
* The code is provided "AS IS", without warranty of any kind.
* IBM shall not be liable for any damages arising out of your or any other parties use of the
sample code, even if IBM has been advised of the possibility of such damages.
* If you do not agree with these terms, do not use the sample code.
*
* Licensed Materials - Property of IBM
*
* \u0040 Copyright IBM Corp. 2008-2012 All Rights Reserved.
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
Schedule
* Contract with IBM Corp.
*
* The source code for this program is not published or otherwise divested of its trade secrets,
* irrespective of what has been deposited with the U.S. Copyright Office.

* You can also add a toolbar event action button and wire it to the Script Adapter as well to act
as a Reset
*/
console.log(this.name, ":Start");
console.debug(this.name, ":Start");

/*
* Begin Configuration Block
*/

/*
* The specific case type we are searching against.
*
* Specify the specific case type without the prefix. You will get the Summary
* view properties in the columns. If you use "", you will get all case types,
* but only the default columns will display.
*/
var myCaseType = "GeneralClaim";

/*
* The case property which is matched against the logged in user ID without the
* prefix.
*/
var myCaseProperty = "Agent";

/*
* The display name of the case property which is matched against the logged in
* user ID.

Page 27 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
10. Create Filter Search SA Widget

*/
var myCasePropertyName = "Agent";

/*
* Wiring Information Incoming Events Source Event Target Event Outgoing Events
* Source Event Target Event
*
* Incoming EventsSearch Search cases Filter Search SA Receive event payload.
* This is the wiring that was tested. Other wiring may be used based on the
* user's needs.
*/
var eventWiring = {
"Incoming Events" : [ {
"Source" : "Page Container",
"Event" : "Page Opened",
"Target" : this.name,
"Event" : "Receive Event payload",
"Comment" : "Populates the Case List on page load."
}, {
"Source" : "Search",
"Event" : "Search cases",
"Target" : this.name,
"Event" : "Receive Event payload",
"Comment" : "Recieves search payload from search widget."
}, ],
"Outgoing Events" : [ {
"Source" : "None Required",
"Event" : "None Required",
"Target" : "None Required",
"Event" : "None Required",
"Comment" : "None Required"

}, ]
};
console.debug(this.name, ": Required Wiring", eventWiring);

/*
* End Configuration Block. Nothing below this point should need modification.
*/
var initialPayload = "";
if (payload) {
console.debug(this.name, ": payload=", payload);
/* payload received from wiring */
initialPayload = payload;

console.debug(this.name, ": initalPayload=", initialPayload);

/* Whether this is an initial search or not. */


var isInitialSearch = initialPayload.eventName == "icm.PageOpened";

console.debug(this.name, ": isInitialSearch = ", isInitialSearch);

/* Parameters for the search */


var params = {};

/* The initial context for this widget */


var self = this;

Page 28 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
10. Create Filter Search SA Widget

/*
* ID of the logged in user that will be inserted into the search criteria.
*/
var userId = ecm.model.desktop.userId;

/*
* The object for the solution we are working.
*/
var solution = this.solution;

/*
* The solution prefix.
*/
var prefix = solution.getPrefix();

/*
* If a solution prefix was provided, then strip it off, then add the solution
* prefix based on the case page.
*/

if (myCaseProperty.indexOf("_") > 0) {
myCaseProperty = myCaseProperty.substring(myCaseProperty.indexOf("_") + 1);
console
.debug(
this.name,
"Because _ was found in myCaseProperty, the _ character and everything that precedes it
were removed. The new value is ",
myCaseProperty);
}

/*
* Insert the prefix onto myCaseProperty
*/
myCaseProperty = prefix + "_" + myCaseProperty;
console.debug(this.name, "myCaseProperty for lookup=", myCaseProperty,
"myCasePropertyName=", myCasePropertyName);

/*
* Criterion for the search we are building. In this case, we only wish to
* display working cases.
*/
var criterion = new ecm.model.SearchCriterion({
"id" : "cmAcmCaseState",
"name" : "CaseState",
"selectedOperator" : "EQUAL",
"dataType" : "xs:integer",
"defaultValue" : 2,
"value" : 2
});

/*
* Search criterion that filters the search so that only cases where
* myCaseProperty matches the users ID.
*/
var criterion1 = new ecm.model.SearchCriterion({
"id" : myCaseProperty,
"name" : myCasePropertyName,
"selectedOperator" : "EQUAL",
"dataType" : "xs:string",
"defaultValue" : userId,

Page 29 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
10. Create Filter Search SA Widget

"value" : userId
});

/*
* If this is the initial search, we need the case type and a default search
* payload.
*/
if (isInitialSearch) {
console.debug(this.name, ": Inside initial search block");
/*
* The case type we are searching against.
*/
var caseType = "";

/*
* If a solution prefix was provided, strip it off, then add the solution
* prefix based on the case page to myCaseType.
*/
if (myCaseType.indexOf("_") > 0) {
myCaseType = myCaseType.substring(myCaseType.indexOf("_") + 1);
console.debug(
this.name,
"Because _ was found in the myCaseType property, the _ character and everything that
precedes it were removed. The new value is ",
myCaseType);
}
/*
* Insert prefix on myCaseType
*/
caseType = prefix + "_" + myCaseType;
console.debug(this.name, "myCaseType=", myCaseType, " caseType=", caseType);

/*
* Set object store Id on params.
*/
params.ObjectStore = solution.getTargetOS().id;

/*
* Set up the search parameters on params.
*/
params.criterions = [ criterion, criterion1 ];
params.CaseType = caseType;
params.solution = solution;

console.debug(this.name, ":Search Parameters=", params);

/*
* Create an instance of a search payload object and pass the parameters.
*/
var searchPayload = new icm.util.SearchPayload();
searchPayload.setModel(params);

console.debug(this.name, ": searchPayload=", searchPayload);

searchPayload.getSearchPayload(dojo.hitch(self, function(payload) {

console.debug(this.name, ": inside dojo.hitch, payload=", payload);


/*
* Remove standard Case State and the case property used for matching
* from display

Page 30 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
10. Create Filter Search SA Widget

*/

/* Instance of a payload details view property */


var property;
/* details view properties to pass in payload that replaces the original */
var newdvprops = [];

/*
* loop through payload details view properties and remove case state
* and the case property used for matching from the display.
*/
for (var i = 0; i < payload.detailsViewProperties.length; i++) {
property = payload.detailsViewProperties[i];
if (property.symbolicName !== "cmAcmCaseState"
&& property.symbolicName !== myCaseProperty) {
newdvprops.push(property);
}
}

payload.detailsViewProperties = newdvprops;

console.debug(this.name, ":Broadcasting initial payload");


self.onBroadcastEvent("icm.SearchCases", payload);
console.debug(this.name, ":Payload broadcasted");
}));
} else {
console.debug(this.name,
": Insert additional criteria into the search payload.");
/* Add the new search criteria to the payload */
initialPayload.searchTemplate.searchCriteria.push(criterion);
initialPayload.searchTemplate.searchCriteria.push(criterion1);

console.debug(this.name, "Broadcast Edited Payload. Payload=", payload);


self.onBroadcastEvent("icm.SearchCases", payload);
console.debug(this.name, ":Payload broadcasted");
}

console.log(this.name, ":End");
console.debug(this.name, ":End");

By default, this code writes to the console when it starts and ends(console.log). This
information is visible in the FireFox debugger and in Firebug. The console.debug
statements cause additional output when &debug=true is appended to the page URL.

10.4. How it Works


The Filter Search SA widget acts as a custom Search widget and it modifies searches that are
submitted by the user. It also filters for a particular Case Type that is specified in the SA script. The
configuration block must be configured for each Case Type. It acts in two ways.
When the user opens the custom Solution page (WorkBench), an initial payload is sent to the
Filter Search SA widget. This causes the widget to broadcast a default search payload to the

Page 31 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
10. Create Filter Search SA Widget

Case List widget. The Case List widget displays active cases for the current user (<Case
Owner> property value = Current user and Case State = Active).
The user can search for specific cases using the out-of-the-box Case Search widget. When
they execute the search, the payload is trapped by Filter Search SA. It inserts the restriction
to only return active cases for the current user(<Case Owner> property value = Current user and
Case State = Active) into the search payload and broacasts it. The Case List widget displays
active cases for the current user with the additional criteria the user specified in the case search
widget.
This script adapter ensures that only the active cases for which the current user is the Case Owner
are ever displayed in the CaseList widget.

Page 32 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
Appendix A:DISCLAIMER OF WARRANTIES.

Appendix A: DISCLAIMER OF WARRANTIES.


This document contains sample code created by IBM Corporation.
IBM grants you a nonexclusive copyright license to use this sample code example to generate similar
function tailored to your own specific needs.
This sample code is not part of any standard IBM product and is provided to you solely for the purpose
of assisting you in the development of your applications.
This example has not been thoroughly tested under all conditions.
IBM, therefore cannot guarantee nor may you imply reliability, serviceability, or function of these
programs.
The code is provided "AS IS", without warranty of any kind.
IBM shall not be liable for any damages arising out of your or any other parties use of the sample
code, even if IBM has been advised of the possibility of such damages.
If you do not agree with these terms, do not use the sample code.
Licensed Materials - Property of IBM
Copyright IBM Corp. 2008-2012 All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
Schedule Contract with IBM Corp.
The source code for this program is not published or otherwise divested of its trade secrets,
irrespective of what has been deposited with the U.S. Copyright Office.

Page 33 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
Appendix B:Notices

Appendix B: Notices
This information was developed for products and services offered in the U.S.A.
IBM may not offer the products, services, or features discussed in this document in other countries.
Consult your local IBM representative for information on the products and services currently
available in your area. Any reference to an IBM product, program, or service is not intended to state
or imply that only that IBM product, program, or service may be used. Any functionally equivalent
product, program, or service that does not infringe any IBM intellectual property right may be used
instead. However, it is the user's responsibility to evaluate and verify the operation of any non-IBM
product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in this
document. The furnishing of this document does not grant you any license to these patents. You
can send license inquiries, in writing, to:
IBM Director of Licensing
IBM Corporation
North Castle Drive
Armonk, NY 10504-1785
U.S.A.
For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual
Property Department in your country or send inquiries, in writing, to:
IBM World Trade Asia Corporation
Licensing
2-31 Roppongi 3-chome, Minato-ku
Tokyo 106-0032, Japan
The following paragraph does not apply to the United Kingdom or any other country where
such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES
CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in
certain transactions, therefore, this statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are
periodically made to the information herein; these changes will be incorporated in new editions of
the publication. IBM may make improvements and/or changes in the product(s) and/or the
program(s) described in this publication at any time without notice.
Any references in this information to non-IBM Web sites are provided for convenience only and do
not in any manner serve as an endorsement of those Web sites. The materials at those Web sites
are not part of the materials for this IBM product and use of those Web sites is at your own risk.

Page 34 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
Appendix B:Notices

IBM may use or distribute any of the information you supply in any way it believes appropriate without
incurring any obligation to you.
Any performance data contained herein was determined in a controlled environment. Therefore, the
results obtained in other operating environments may vary significantly. Some measurements may
have been made on development-level systems and there is no guarantee that these measurements
will be the same on generally available systems. Furthermore, some measurements may have been
estimated through extrapolation. Actual results may vary. Users of this document should verify the
applicable data for their specific environment.
Information concerning non-IBM products was obtained from the suppliers of those products, their
published announcements or other publicly available sources. IBM has not tested those products and
cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM
products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of
those products.
All statements regarding IBM's future direction and intent are subject to change or withdrawal without
notice, and represent goals and objectives only.
This information contains examples of data and reports used in daily business operations. To illustrate
them as completely as possible, the examples include the names of individuals, companies, brands,
and products. All of these names are fictitious and any similarity to the names and addresses used by
an actual business enterprise is entirely coincidental. All references to fictitious companies or
individuals are used for illustration purposes only.

Page 35 of 38 Last Modified: Bob Jackson 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
Appendix C:Trademarks and copyrights

Appendix C: Trademarks and copyrights


The following terms are trademarks of International Business Machines Corporation in the United
States, other countries, or both: IBM, ILOG, FileNet, Lotus, WebSphere, Cognos.

Adobe, Acrobat, Portable Document Format (PDF), and PostScript are either registered trademarks
or trademarks of Adobe Systems Incorporated in the United States, other countries, or both.

Cell Broadband Engine is a trademark of Sony Computer Entertainment, Inc. in the United States,
other countries, or both and is used under license therefrom.

Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the
United States, other countries, or both. See Java Guidelines

Microsoft, Windows, Windows NT, and the Windows logo are registered trademarks of Microsoft
Corporation in the United States, other countries, or both.

Intel, Intel logo, Intel Inside, Intel Inside logo, Intel Centrino, Intel Centrino logo, Celeron, Intel
Xeon, Intel SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel
Corporation or its subsidiaries in the United States and other countries.

UNIX is a registered trademark of The Open Group in the United States and other countries.

Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.

ITIL is a registered trademark and a registered community trademark of the Office of Government
Commerce, and is registered in the U.S. Patent and Trademark Office.

IT Infrastructure Library is a registered trademark of the Central Computer and Telecommunications


Agency which is now part of the Office of Government Commerce.

Other company, product and service names may be trademarks or service marks of others.

Page 36 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11


Creating Case Custom Workbench Pages in IBM Case Manager 5.2
Appendix C:Trademarks and copyrights

Copyright IBM Corporation 2014.

The information contained in these materials is provided for


informational purposes only, and is provided AS IS without
warranty of any kind, express or implied. IBM shall not be
responsible for any damages arising out of the use of, or
otherwise related to, these materials. Nothing contained in
these materials is intended to, nor shall have the effect of,
creating any warranties or representations from IBM or its
suppliers or licensors, or altering the terms and conditions of
the applicable license agreement governing the use of IBM
software. References in these materials to IBM products,
programs, or services do not imply that they will be available
in all countries in which IBM operates. This information is
based on current IBM product plans and strategy, which are
subject to change by IBM without notice. Product release
dates and/or capabilities referenced in these materials may
change at any time at IBMs sole discretion based on market
opportunities or other factors, and are not intended to be a
commitment to future product or feature availability in any
way.

IBM, the IBM logo and ibm.com are trademarks or registered


trademarks of International Business Machines Corporation in
the United States, other countries, or both. If these and other
IBM trademarked terms are marked on their first occurrence
in this information with a trademark symbol ( or ), these
symbols indicate U.S. registered or common law trademarks
owned by IBM at the time this information was published.
Such trademarks may also be registered or common law
trademarks in other countries. A current list of IBM
trademarks is available on the Web at Copyright and
trademark information at ibm.com/legal/copytrade.shtml

Other company, product and service names may be


trademarks or service marks of others.

Page 38 of 38 Last Modified: rej@us.ibm.com 2014-06-12 13:11

You might also like