IBM Support

Add case document to an attachment in the Attachment widget

Technical Blog Post


Abstract

Add case document to an attachment in the Attachment widget

Body

This is in response to a question from a partner about how to add a new document to an attachment in Attachment widget from one that is already filed into the current case.

Currently, there is no out of the box feature in the Attachment widget that allows you to do this easily. However, there is a relatively simple customization that can do what you want here. This involves using a Script Action (note: not the Script Adaptor widget) and a little bit of javascript. Here are the steps:

1. in Case Builder, Open the solution, go to Pages tab and Edit the Work Details page.
2. In the Case Information widget, click on its Edit Settings and select the Menus tab in the dialog.
3. Add a new menu item, and select Script Action in the Action dropdown.
4. Enter the label for the action, for example: Add case document to attachment
5. In the Execute edit box, enter this script:

   var selectedCaseDocument = this.getActionContext("Document");
   this.broadcastEvent("icm.AddAttachment", {"attachmentName":"<attachment id>", "documents":selectedCaseDocument});

6. Click OK and OK again to save the settings.

7. Save the page, and deploy the solution.

8. in runtime Case Client, Open the work item that has the attachment, and add a new document to the Document tab of the Case Information widget.

9. Right click on new doc which should show the new Script Action in the dropdown context menu.

10. Select the script action which should add the document to the attachment in the Attachment widget.

11. That's it. Don't forget to provide the correct <attachment id> in step 5.

A few things to note about this customization are:

 - The desired document needs to be in the case first as indicated in step 8.

 - It can only add to a specific attachment as specified by the attachment id in step 5. Note that the attachment id is the one that you've created and specified when you create the task in Case Builder.

 

[{"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

ibm11281442