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:
- 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 Call complete from in basket widget in IBM Case Manager Client.
- Output will be like:
Note: Similar requirement can be achieved by change response name and move case(s) step forward as well.