Technical Blog Post
Abstract
How to preload the ICM Case List with a search of my choosing?
Body
With the out of the box IBM Case Manager Cases page, the Case List is displayed initially empty, waiting for the user to perform a search. Wouldn't it be nice to pre-fill the case list with items of interest to the user? Here are a few examples how to do that in ICM 5.2.0.1 (These examples require Fix Pack 1)
- Add a Script Adapter to the hidden widgets area
- Wire the Page Container's Open Page event to the Script Adapter's incoming Receive Event Payload event
- You can also add a toolbar event action button and wire it to the Script Adapter as well to act as a Reset
var solution = this.solution; var params = {}; var self = this; params.ObjectStore = solution.getTargetOS().id; var criterion = new ecm.model.SearchCriterion({"id": "CmAcmCaseIdentifier", "selectedOperator": "STARTSWITH", "dataType": "xs:string", "defaultValue" : "%", "value": "%", "values": ["%"]}); params.criterions = [criterion]; params.CaseType = solution.getPrefix()+"_Incident"; /* How can this be all case types in the solution? Answer: Use empty string*/ params.solution = solution; var searchPayload = new icm.util.SearchPayload(); searchPayload.setModel(params); searchPayload.getSearchPayload(dojo.hitch(self, function(payload) { self.onBroadcastEvent("icm.SearchCases", payload); }));
- Setting multiple criteria
params.ObjectStore = solution.getTargetOS().id; var criterion1 = new ecm.model.SearchCriterion({"id": "CmAcmCaseIdentifier", "selectedOperator": "STARTSWITH", "dataType": "xs:string", "defaultValue" : "%", "value": "%", "values": ["%"]}); var criterion2 = new ecm.model.SearchCriterion({"id": creationDateAttr, "selectedOperator": "GREATEROREQUAL", "dataType": "xs:date", "defaultValue" : stamp.toISOString(creationDate), "value": stamp.toISOString(creationDate), "values": [stamp.toISOString(creationDate)]}); params.criterions = [criterion1, criterion2];
- Searching for a specific property value and removing it from the result list columns
var solution = this.solution; var params = {}; var self = this; /* The specific case type (you will get the Summary view properties in the columns ) */ var caseType = solution.getPrefix() +"_NewAccount"; var priority = solution.getPrefix() +"_Priority";
/* For all case types, use "" (but you will get the default columns) */ params.ObjectStore = solution.getTargetOS().id; var criterion = new ecm.model.SearchCriterion({"id": "cmAcmCaseState", "name":"CaseState", "selectedOperator": "EQUAL", "dataType": "xs:integer","defaultValue" : 2, "value": 2}); params.criterions = [criterion]; params.CaseType = caseType; params.solution = solution; var searchPayload = new icm.util.SearchPayload(); searchPayload.setModel(params); searchPayload.getSearchPayload(dojo.hitch(self, function(payload) { /*Remove standard Case State property from display*/ var property; var newdvprops = []; for (var i=0; i<payload .detailsViewProperties.length; i++) { property = payload .detailsViewProperties[i]; if(property.symbolicName !== "cmAcmCaseState" ){ newdvprops.push(property); }; }; payload.detailsViewProperties = newdvprops;
/* add sort by priority */ payload.searchTemplate.resultsDisplay.sortAsc = true; payload.searchTemplate.resultsDisplay.sortBy = priority;
self.onBroadcastEvent("icm.SearchCases", payload ); }));
- The relationship between criterions(AND or OR) can be setted by param.andSearch=true|false
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSCTJ4","label":"IBM Case Manager"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
UID
ibm11281244