IBM Case Manager (ICM), IBM Case Manager Builder, IBM Case Manager Client

Call Complete() from In-Basket Widget in IBM Case Manager 5.2.x / 5.3.x

July 30, 2019

There is very good post about how to call complete() from In-Basket widget which illustrate well on developerswork post.

Following are the steps to achieve this requirement:

  • Open Page designer of In-Basket widget in IBM Case Manager Builder.
  • Add custom menu on In-Basket widget settings.
  • Select action type Event Action and name Label Complete(s) Case as described below:
Call-Complete()-from-In-Basket-Widget
  • Add the following code in execute section of custom event action.

Code:

var selectedWorkItems = payload.WorkItemReference;
var currentWorkItem;
var CONST_RESPONSE="
Complete";
var processedItems =[];
var currentWIE;

if (dojo.isArray(selectedWorkItems)) {
require(["dojo/_base/array"], function(array) {
try {
array.forEach(selectedWorkItems, function (currentWorkItem, idx) {
currentWorkItem.retrieveAttributes(function (currentWob) {
try {
currentWIE = currentWob.createEditable();
currentWIE.lockStep(function(currentWIE) {
try {
currentWIE.setSelectedResponse(CONST_RESPONSE);
currentWIE.completeStep(function(){
try {
processedItems.push(idx);
if (processedItems.length == selectedWorkItems.length) {
//self.onBroadcastEvent("icm.Refresh", {});
//self.onBroadcastEvent("icm.Refresh", payload);
//this.onRefresh();
}
}
catch (Error) {
alert(Error.name + " - " + Error.description + "\r\n" + Error.message);
}
});
}
catch (Error) {
alert(Error.name + " - " + Error.description + "\r\n" + Error.message);
}
});
}
catch (Error) {
alert(Error.name + " - " + Error.description + "\r\n" + Error.message);
}
});
});
}
catch (Error) {
alert(Error.name + " - " + Error.description + "\r\n" + Error.message);
}
});
}
else {
currentWorkItem = selectedWorkItems;
currentWorkItem.retrieveAttributes(function (currentWob) {
try {
currentWIE = currentWob.createEditable();
currentWIE.lockStep(function(currentWIE) {
try {
currentWIE.setSelectedResponse(CONST_RESPONSE);
currentWIE.completeStep(function(){
try {
//self.onBroadcastEvent("icm.Refresh", {});
//self.onBroadcastEvent("icm.Refresh", payload);
//this.onRefresh();
} catch (Error) { alert(Error.name + " - " + Error.description + "\r\n" + Error.message); } }); } catch (Error) { alert(Error.name + " - " + Error.description + "\r\n" + Error.message); } }); } catch (Error) { alert(Error.name + " - " + Error.description + "\r\n" + Error.message); } });
}

  • Once done, save and close the widget settings.
  • Deploy the solution.
  • Test the custom complete() option from In-Basket widget in IBM Case Manager Client.
  • Output will be like:
complete-multiple-cases

Note: Similar requirement can be achieved by change response name and move case(s) step forward as well.

You Might Also Like

No Comments

Leave a Reply

error

Subscribe