About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Technical Blog Post
Abstract
IBM Case Manager - Attachments Widget Refresh Fix
Body
Come on a journey with me, let’s suppose we have the following widgets in our Work Details page: Work Item Toolbar, Properties, Case Information and Attachments. Now, imagine you are a Case Worker and you are aware that the company use case scenarios are a kind of complex and we have heard that our development team was forced to push further the OOTB capabilities of our case management platform. We start using the document-wise capabilities of Case Client and some weird behavior starts to happen for specific use cases.
1. Problem Determination
We have the requirement to add and edit documents using the so called “Edit Services”. In that matter, there are corresponding menu actions available for the widgets. Let’s suppose the Edit document use case.
In this case, we have configured the ‘Edit with Desktop apps’ menu action in the toolbar for both the Case Information Widget > Documents tab and the Attachments widget. Now, we have the “READ ME FIRST.doc” attachment with major version 1.0, and we apply the “Edit with Desktop apps” action on it. Our document opens with Microsoft Word, we edit and close it saving the changes and a new version of our document is uploaded as a major version, everything is fine so far.
We use the Attachments widget toolbar's Refresh button to make sure we are seeing the properties and modified details of the released version of our document.
After the refresh, we may see that the modified details are updated but as soon as we open the attached document properties, as shown below, we are still in the document's initial version, instead of the major version 2.0 yielded from the Edit services edition, changing and MS Word closing. Moreover, if we click on the drop-down box next to Versions field, we see our version 2.0, but 1.0 is selected by default. That will, for sure, lead the user to confusion.
The widget hasn’t automatically refreshed the work item once the document was uploaded and neither the Refresh button wasn’t able to refresh it correctly.
This problem is solved if the work item is saved or processed and the work details page is closed and opened it again, but this does not seem feasible when it comes to user experience and streamlined interaction
In latest versions of the platform (ICM 5.3.2 and ICN 3.0.3 Case Client) ,this error is solved for the Case Information Widget using the Refresh button or even selecting the document to be updated (hooking the select item event), but not for the Attachments widget. Moreover, having the platform at latest fixpack is tedious and is not practical for all of the customers our there.
Well, if you find yourself in such a mess of a problem and you have tried to solve it somehow, you do not have to struggle with that anymore, cause we have already figured it out for you, and guess what, we’ve come up with something that works.
2. The Solution
For the sake of simplicity and as a bootstrap example, a new global menu action for the Work Details page has been developed so that we can have the underlying work item refreshed and updated, performing a work item save and making the rest of the widgets aware of the change.
2.1 Step by Step Configuration
1. Go to Case Builder Page Editor and open the Work Item Toolbar widget from your Work Details page. Open Toolbars tab and click the Add Menu icon to create a button with the following properties.a.
- Action: Event Action
- Label: Refresh Document
- Menu Identifier: RefreshDocuments
- Event Name: icm.refreshDocuments
- Event Type: Wiring
2. Leave Show and Enable boxes empty and press OK to add the menu to the toolbar. Arrange the button with a Separator as shown to separate the button from the response buttons:
3. Now add a new script adapter widget and add the following JS code to it from the Edit Settings button:
var self = this;
var toolbar
var keys=Object.keys(self.page)
for(var i=0;i<keys.length;i++){
if(keys[i].match("WorkitemToolbar"))
toolbar=self.page[keys[i]]
}
require(["dojo/aspect",
"dojo/_base/lang",
"icm/pgwidget/attachment/Attachment",
"icm/base/Constants",
"icm/action/Action"],
function(aspect,lang,Attachment,Constants, ICMAction){
/*Wire to page container icm.SendWorkItem event, retrieve the workitem*/
if(payload.eventName == "icm.SendWorkItem"){
self.workItemEdt = payload.workItemEditable;
self.UIState = payload.UIState;
self.workItemEdt.retrieveStep(function(){
self.case = self.workItemEdt.getCase();
self.coordination = payload.coordination;
});
}
/*Wire to event action on attachment, which published the user
configured event icm.AddDocToBothCaseAndAttachment*/
if(payload.eventName == "icm.refreshDocuments"){
//SAVE
var participated=self.coordination.participate(Constants.CoordTopic.AFTERSAVE,
function(context, complete, abort){
try {
this.handler = aspect.around(Attachment.prototype, "handleICM_SendWorkItemEvent",
function(originalMethod) {
return function(payload) {
if ((!payload) || (!payload.workItemEditable))
return;
if(payload.workItemEditable) {
var editable = payload ? payload.workItemEditable : null;
this.handleViewAttachmentEvents (editable);
handler.remove();
self.coordination.cancel(participated);
//SAVE
ICMAction.perform(toolbar, "icm.action.workitem.SaveWorkItemOnPage",toolbar.getActionContext());
}
});
var workItem = self.workItemEdt.icmWorkItem;
self.editable2 = workItem.createEditable();
self.onBroadcastEvent("icm.SendWorkItem",
{"workItemEditable":self.editable2, "coordination":self.coordination, "UIState":self.UIState});
} catch (err) {
alert("Error on work item close: " + err);
abort();
}
complete();
}); //End participate
ICMAction.perform(toolbar, "icm.action.workitem.SaveWorkItemOnPage",toolbar.getActionContext());
}
});
**Saving of the work item was needed because of the Add new attachment use case. When refreshing, there exists a synchronization problem which forces us to perform a save of the work item previous to the actual refresh.
4. And now configure the following, where the magic happens.
Click on the Edit Wiring button and add the following wires in the Incoming Events section:
Source | Event | Target | Event |
Page Container | Send work item | Script Adapter | Receive event payload |
Work Item Toolbar | *icm.refreshDocuments | Script Adapter | Receive event payload |
5. Last but not least, verify the Block outbound event box is checked.
And that’s all, you can now go and test this Refresh Documents button in IBM Content Navigator Case Client and see how both Attachments and Case Information widgets are refreshed showing the latest documents versions.
3. Possible Improvements
This article explains a foundation for possible enhanced solutions to the stated problem. For instance, the mechanism to trigger the refresh can be replaced by some automatic refresh through wiring thus achieving a better seamless user interaction with the page.
4. Conclusion
This solution helps to solve a very specific flaw in latest Case Client version (ICM 5.3.2 and ICN 3.0.3) related to the attachments widget behavior as explained above.
Nevertheless, some more flaws have been identified during the solution testing phase for older versions of the platform. Since there are plenty of IBM customers still working with older versions of the products, this fix represents a solution for multiple refresh issues within work details pages.
Daniel Díaz Bejarano
Razvan Mihai Alungei,
IBM Analytics Services. SPGI
Regards
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSCTJ4","label":"IBM Case Manager"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
UID
ibm11280734