IBM Support

Adaptive Case Management Example

Technical Blog Post


Abstract

Adaptive Case Management Example

Body

Hello ECM community members. Guess who's back! ;)

We have some really great things planned for IBM Case Manager in 2017 and we are hard at work on a couple of releases.

In the meantime, I thought I would share a little example you can add to your solutions that is actually quite powerful given how easy it is. Adaptive Case Management is a term that generally means your case solutions adjust their capabilities as a case transitions through its lifecycle. For example, there may be actions that case workers can perform when a case is new, but should not be available later on.

 

For this example, we want to control what discretionary tasks are available for a case user to select based on a property value.

  • Add a few Discretionary Tasks to your case type. These tasks will appear in the Add Tasks dialog display from the Add Tasks toolbar button.
  • The code uses a case property called CaseStatus and exposes it in the property views. Change the name reference to any property you want
  • Add a Script Adapter widget to your Case Details page
  • Wire an incoming event using the Send Case Information event from the Page Container
  • Enter the following script into the Script Adapter
var solution = this.solution;
var prefix = solution.getPrefix();
var value = "";

require([ "icm/model/properties/controller/ControllerManager"], function(ControllerManager) {
   var propId = prefix + '_CaseStatus';

   /*Retrieve prop value using property controller API*/

   var theController = ControllerManager.bind(payload.caseEditable);
   var propController = theController.getPropertyController(propId);
   value = propController.get("value");

   /*Unbind is necessary to prevent mem leak.*/
   ControllerManager.unbind(payload.caseEditable);
   console.log(value);
});

theCaseType = payload.caseEditable.caseType;
theCaseType.retrieveDiscretionaryTaskTypes(dojo.hitch(self, function (theTasks) {
   /* theTasks is a nice array of discretionary task objects */
   theTasks[0].hidden = value == "New";
   console.log("Task hidden: ",theTasks[0].hidden);
}));

return payload;

In this simplified example, we just show or hide the first discretionary task in the array that is passed to us. A more production class example might do something smarter like test the user's role and use the task ID that is part of the task object you get to determine which tasks to allow.

The secret sauce here is the retrieveDiscretionaryTaskTypes method on the case type. This call must be made before trying to access the discretionary tasks since they are loaded into the caseEditable on demand. From that point on, any caller will be passed the in-memory array which explains why our modifications are picked up by others during the life of the caseEditable.

 

I hope this example helps you in your solutions. I'll have lots more to tell you about pretty soon!

d

 

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

ibm11280848