iParagons

IBM FileNet P8 | Case Manager | Content Navigator

How to Make Comments Required on Work Details Page in Case Manager

IBM Case Manager (ICM)

How to Make Comments Required on Work Details Page in Case Manager

By Junaid Azam / Dec 16, 2021

How to make comments required to capture a comment when a user chooses to process a work item with a particular response? For example, if a work item is Rejected or approved, you must enter a reason for its approval or rejection that will be part of the case history.

Environment:

  1. Case Manager 5.2.x / 5.3.x
  2. Content Platform Engine 5.2.x / 5.5.x
  3. Content Navigator 2.0.3.x / 3.0.x
  4. WebSphere Application Server 7.0.0.x / 8.5.5.x / 9.0.x

Solution:

Perform the following steps to make comments required on work details page accordingly:
  • Edit the solution in IBM Case Manager Builder.
  • Go to the pages section, edit the desired work details page.
  • Show the hidden widgets section, drag a new script adaptor in this area, and rename it so you can remember the purpose.
  • Wiring the incoming event to the Work Item Toolbar's Send Work Item event as mentioned in the below diagram:
ibm case manager attachment wiring
  • Edit the settings of script adaptor and add the following code:
var coord = payload.coordination; var workitemEdit = payload.workItemEditable; var solution = this.solution; var prefix = solution.getPrefix(); require(["icm/base/Constants","icm/model/properties/controller/ControllerManager"], function(Constants, ControllerManager){ require(["dojo/_base/declare", "dojo/_base/lang", "icm/base/Constants","icm/dialog/addcommentdialog/AddCommentDialog","icm/action/case/CaseAction"], function(declare, lang,Constants, AddCommentDialog, CaseAction) { console.log("Prompt add work item comment dialog throughscript adaptor."); payload.coordination.participate('COMMIT', lang.hitch(this,function(context, complete, abort) { var workitemEditable =payload.workItemEditable; try { var workFlowName = workitemEditable.getWorkflowName(); //console.log("workFlowName:" + workFlowName); var myStepName =workitemEditable.getStepName(); var myCase = workitemEditable.getCase(); var commentAdded = false; console.log("myCase: " + myCase); console.log("coord: " + coord); /* if(context[Constants.CoordContext.WKITEMRESPONSE] ==="Process Request") */ // If you use this condition, than it will be prompt at once whatever the response button name on work details page. if(context[Constants.CoordContext.WKITEMRESPONSE] !=="abc") { var addCommentDialog = new AddCommentDialog({ artifactType : "WorkItem", artifactLabel : myStepName, commentContext :Constants.CommentContext.WORK_ITEM_COMPLETE, caseModel : myCase, workItem :workitemEditable.icmWorkItem, onClickClose : function() { if (commentAdded) { complete(); } else { alert ("You have to provide your remarks on this case please."); abort({silent:true}); } AddCommentDialog.prototype.onClickClose.apply(this,arguments); } }); dojo.connect(addCommentDialog.commentContentPane, "afterAddComment",lang.hitch(this,function() { commentAdded = true; })); addCommentDialog.show(); } else { complete(); } //}); //}; } catch (exception) { alert(exception); abort(); } })) }) }); return payload;
  • Close the page, commit, and deploy the solution.
  • Open the work details page again to test your customization.
  • When a user clicks on particular response button, a new comments window will be appreard as described here:
how to make comments required on work details page in case manager
  • If user clicks cancel on the prompt dialog, the event is not passed on and will remain on the page.
adding comments before dispatching the workitem in ibm case manager
  • If user enters a reason in comments section and click OK, the case will be forwarded and a new comment will be added to the case.
On this tech note you can find the further information about all the payloads and events: https://www.ibm.com/docs/en/case-manager/5.3.0?topic=packages-case-manager-javascript-icmaction-package

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *