IBM Advanced Case Manager: In some cases, there is requirement that when user clicks a particular response button on Work Details Page in IBM advanced case manager Client a custom audit history has to be created along with time stamp and user’s name in the history tab. Following are steps to achieve this:
Environment: ICM 5.2.x / ICM 5.3.x
- Edit specific Work Details Page in IBM Case Manager Builder.
- Add a new hidden script adaptor and named it uniquely.
- Edit script adaptor setting and put the following code:
Note: Please change Response Button and Case Properties according to your own environment.
var currentWorkitem = payload.workItemEditable;
var currentCase = currentWorkitem.getCase();
var selectedResponse = currentWorkitem.getSelectedResponse();
if (selectedResponse == “Forward”)
{
addCommentToCase(currentCase,”Selected response:”+selectedResponse);
showPrintPopup(currentCase,selectedResponse,[“CmAcmCaseIdentifier”,
“JNP_SampleProperty”,”JNP_OtherProperty”,”Creator”,”DateCreated”]);
}
else
{
var a;
a = alert(“You Pressed: “+selectedResponse);
addCommentToCase(currentCase,”Selected response:”+selectedResponse);
}
function addCommentToCase(currentCase,text){
currentCase.addCaseComment(102,text,function onReady(){
console.log(“comment was set!”);
},function onFailure(){
console.error(“could not create case comment”)
},true);
}
new_window.document.write(‘
‘); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(‘Date: ‘+DateC+’
‘);
new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(‘CSO ID: ‘+CreatedBy+’
Case Type: Test Case
‘);
new_window.document.write(‘
‘);
new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”); new_window.document.write(”+CaseID+’
‘+SampleProp+’
‘+OtherProp+’
‘);
new_window.document.write(‘
‘);
}
return payload;
- Edit script adaptor wiring ad described here:
- Once done, save and deploy solution.
- Test custom history event audit on that specific work details page.
- An example is attached here in which clearly mentioned when user clicks on Forward response button, it will be automatically captured in history tab on work details page in ibm case manager client.