I was following the article (
Call Complete() from In-Basket Widget in IBM Case Manager 5.2.x / 5.3.x - iparagons blog/) for trying to complete multiple cases at once in BPM Process. But when I am trying to run it like the below image, I am getting the following error.
This is the code I am using.
var selectedWorkItems = payload.WorkItemReference;
var currentWorkItem;
var CONST_RESPONSE = "Submit";
var processedItems = [];
var currentWIE;
console.log("start");
console.log(selectedWorkItems);
require(["dojo/_base/array"], function(array) {
if (dojo.isArray(selectedWorkItems)) {
console.log("1");
try {
console.log("2");
array.forEach(selectedWorkItems, function(currentWorkItem, idx) {
console.log(currentWorkItem);
currentWorkItem.retrieveAttributes(function(currentWob) {
console.log("3");
try {
currentWIE = currentWob.createEditable();
console.log(currentWIE);
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 {
console.log("else");
currentWorkItem = selectedWorkItems;
currentWorkItem.retrieveAttributes(function(currentWob) {
console.log("e1");
console.log(currentWorkItem);
try {
currentWIE = currentWob.createEditable();
console.log("e2");
console.log(currentWIE);
currentWIE.lockStep(function(currentWIE) {
console.log("e3");
try {
currentWIE.setSelectedResponse(CONST_RESPONSE);
console.log("Response");
console.log(CONST_RESPONSE);
currentWIE.completeStep(function() {
console.log("e4");
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); } });
} catch (Error) {
alert(Error.name + " - " + Error.description + "\r\n" + Error.message);
}
});
} catch (Error) {
alert(Error.name + " - " + Error.description + "\r\n" + Error.message);
}
},function(errcurrentWIE) {
console.log(errcurrentWIE);
});
} catch (Error) {
alert(Error.name + " - " + Error.description + "\r\n" + Error.message);
}
});
}
});
------------------------------
Alistair Gardner
------------------------------