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.
  • 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);
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."
'silent': true
} else {
  • 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:

You Might Also Like


  • Reply Jyothi September 13, 2022 at 7:41 pm

    Hi Junaid,

    The information is very useful. Can we use the script adapter to validate the filetype and size of an attachment?


    • Reply Junaid Azam September 14, 2022 at 12:08 pm

      Hi JYOTHI,

      Yes, we can use the script adaptor widget to validate two two properties as well by adding custom javascript logic into this code. E.g.

      const oFile = document.getElementById(“fileUpload”).files[0];
      if (oFile.size > 2097152) // 2 MiB for bytes.
      alert(“File size must under 2MiB!”);

      Secondly, you can restrict filetype in IBM Content Navigator (ICN) -> document viewer mapping section but obeviously it will apply for all. You can also set maximum upload filesize limit in filenet as well but it will affect on all documents.

      However, this is good idea, i will drill it down and let you know the solution by implementing this logic. Thank you.

  • Reply Jyothi September 14, 2022 at 12:53 pm

    Thank you so much for the prompt reply Junaid. Really waiting for insights of the solution.

    • Reply Junaid Azam September 26, 2022 at 11:39 am

      Hi JYOTHI,

      After working on this requirement that you asked, one of my best buddy find out following:

      p.retrieveAttachmentContents(function(items) contains both contentsize as well as mimetype as well. So simply modify this funection by including these as well:

      items[0].contentSize(number of bytes)
      items[0].mimetype (content type)

      Hope it will help you. Thanks.

    Leave a Reply