IBM Support

Work with related cases after you "split" a case

Technical Blog Post


Abstract

Work with related cases after you "split" a case

Body

With ICM 5.1 a new feature 'Split Case' was introduced. This feature allows you to create a new case while working on a case and copy any case properties and documents from the existing case to the new case.  There are several use cases where you would want to be able to split a case into multiple cases, e.g.:
  • A claim that appears to have sub-claims that need to be investigated by different specialists 
  • A request that consists of multiple components, with different resolution time lines 
etc.  

Of course we want ICM to support such use cases.  The ICM documentation explains how to configure the client to allow these split cases to be created: 
  • Edit the toolbar widget on the out-of-the-box Case Details page 
  • Add a new button with action="Split a Case" and give it a name
Clicking this new button will open a new page that allows you to select what case properties and what documents should be copied from the existing case to the new case. 
Now when you have created some new cases this way, then you want to see in your solution that your original case has some related cases. Also, when you select one of the cases created this way, then you want to see the parent case from which the case was "split off". That's not well documented, so it's time to solve that problem.  I'm assuming here that you want the related cases to show up in a list box under your In-basket and that selecting a work item will display any related cases in the list box.  
Dave Perman's tips and tricks came in handy here, and a lot of what you find here was posted by Dave before.

Here we go:
1. Add a new 'Case List' widget to your 'Work' page, and give it a proper name (e.g. "Related Cases")
2. Also add a new 'Script Adapter' widget and give that a name, if you already have one or more of those on your page..
3. Wire your 'In-basket' widget to the new Script Adapter widget, using the 'Row Selected' event.
4. Wire the new Case List widget to the Script Adapter using the 'Search cases' event.
5. Edit the Script Adapter widget and paste the following code in there:
 
this._enabler = com.ibm.mashups.enabler;                                                                            
this._navStateModel = this._enabler.model.state.NavigationStateModelFactory.getNavigationStateModel();
this._spaceAccessor = this._enabler.model.state.AccessorFactory.getSpaceAccessor(this._navStateModel);       
this.spaceModel = com.ibm.mashups.enabler.space.Factory.getSpaceModel();                                                                             
var currentSpaceID = this._spaceAccessor.getSpaceID();
var currentSpaceNode = this.spaceModel.find(currentSpaceID).start();
var atos = currentSpaceNode.getMetaData("com.ibm.acm.SolutionTargetOS");

var serverBase=window.location.protocol + "\/\/" + window.location.host;  
var theFolderId=payload.systemProperties.caseFolderId;                                                            

//remove the curly quotes:                                                         
theFolderId= theFolderId.substr(1,theFolderId.length-2);                                                                                    
var getRelatedCases=serverBase + "/CaseManager/CASEREST/v1/case/" + theFolderId + "/cases?TargetObjectStore=" + atos;                                

var xmlhttp= new XMLHttpRequest();                                                              
xmlhttp.overrideMimeType("application/json");                                                              
xmlhttp.open('GET' , getRelatedCases, false);                                                              
xmlhttp.send();                                                        
           
//parse the payload into an array:                                                                                  
var myResArray=eval('('+xmlhttp.responseText+')'); 
var nrCases= myResArray.length;       
          
if (nrCases==0)         
//then clear any content there may be in the 'related cases' list box       
{                     
 var SQLQuery="SELECT * FROM CmAcmCaseFolder WHERE CmAcmCaseIdentifier= '0'";        
}        
           
if (nrCases>0)                     
{                     
 var SQLQuery="SELECT * FROM CmAcmCaseFolder WHERE (CmAcmCaseIdentifier= '"+myResArray[0].CaseIdentifier+"'";                     
 if (nrCases>1)                     
 {                     
  for (var CaseNr=1; CaseNr<nrCases; CaseNr++)                                   
  SQLQuery=SQLQuery+" OR CmAcmCaseIdentifier= '"+myResArray[CaseNr].CaseIdentifier+"'";                  
 }                     
 SQLQuery=SQLQuery+")";                    
}              

//build the search string using the above SQLQuery (customize as needed):
theSearch={"CaseType":"","ObjectStore": atos,"SortingProperties":
[{"symbolicName":"cmis:lastModificationDate","type":"datetime","displayName":"Date Modified"},
{"symbolicName":"cmis:lastModifiedBy","type":"string","displayName":"Modified By"}],"SystemProperties":
[{"symbolicName":"p8ext:ClassDisplayName","type":"string","displayName":"Case Type"},
{"symbolicName":"cmis:lastModifiedBy","type":"string","displayName":"Modified By"},
{"symbolicName":"CmAcmCaseState","type":"string","displayName":"Case State"},
{"symbolicName":"cmis:lastModificationDate","type":"datetime","displayName":"Date Modified"}],"SearchProperties":
[{"symbolicName":"CmAcmCaseIdentifier","displayName":"Case ID","type":"string","orderable":true}],"SummaryProperties":null,"QuerySQL":SQLQuery};     
return theSearch; 
 
6. Save it and you're ready to go.  Now when you select a work item that has one or more "split-off" cases, then those cases should show up in the 'Related Cases' list box.  When you select a case that was split off from another case, then the original case should show up in the 'Related Cases' list box. 
 
In one of his Tips and Tricks submissions, Dave Perman explained how you can show related cases based on an identical case property.  Decide for yourself what best fits your use case.
 

[{"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

ibm11281850