IBM Case Manager (ICM), IBM Case Manager Client

Attachment Validation in IBM Case Manager 5.2

September 9, 2020

There is a requirement to validate attachment in IBM Case Manager Client (ICM) before dispatching the workflow to next node. Because sometimes, user skip attach document in the case. If you want to mandatory user must add document before clicking on particular step than attachment validation in IBM Case Manager can be achieved be performing following steps:

  • Add a script adaptor widget to the hidden widgets area on a work details page and rename it some distinguish.
  • Wire an inbound event from the Page Container’s Send Work Item to the Script adaptor’s Receive Event.
ibm-case-manager-attachment
  • The additional data validation will be triggered when the appropriate response button is clicked.
function validateWItemAttachments(propertiesCollection) 
{
var emptyattachment = false;
console.log("emptyattachment Flag is--" + emptyattachment);
if (propertiesCollection) 
{
var k;
for (k in propertiesCollection) 
{
if (propertiesCollection.hasOwnProperty(k)) 
{
var p = propertiesCollection[k];
if (p.dataType == "xs:attachment") 
{
console.log("Found Attachment Field--" + k);
console.log(p);
console.log(p.value);
p.retrieveAttachmentContents(function(items) 
{
console.log(items);
if (items.length == 0) 
{
emptyattachment = true;
}
});
}
}
}
}
return emptyattachment;
}
var workItemEdt = payload.workItemEditable;
var coord = payload.coordination;
var propertiesCollection = payload.workItemEditable.propertiesCollection;
require(["icm/model/properties/controller/ControllerManager", "icm/base/Constants", "dojo/date"],
function(ControllerManager, Constants, date) {
// use the validate coordination topic to handle validation of the
// the attachments
coord.participate(Constants.CoordTopic.VALIDATE, function(context, complete, abort) 
{
if (context[Constants.CoordContext.WKITEMRESPONSE] === "Forward") 
{
var inValidAttachmentsFlag = validateWItemAttachments(propertiesCollection);
if (inValidAttachmentsFlag) 
{
var messageDialog = new ecm.widget.dialog.MessageDialog(
{
text: "Attachment missing, please attach document to proceed further."
});
messageDialog.show();
abort(
{
'silent': true
});
} else {
complete();
}
}
else{
complete();
}
});
});
  • Save and close the solution once you applied these changes.
  • Deploy the solution and test the case. You will see when user forward case without attachment, a pop-up window will appear according to your message in the script adaptor code.
  • Below is the screenshot for demonstration:
attachment validation in ibm case manager

Note: This code works for both ICM 5.2.x and 5.3.x versions.

For more information about attachment validation in IBM Case Manager, please check this tech note: https://www.ibm.com/support/pages/attachment-validation-based-which-step-response-selected

You Might Also Like

No Comments

Leave a Reply

error

Subscribe