IBM Content Navigator has a handy feature to save documents or folders to users' Favorites list thereby enabling quick access to those items from the Favorites feature. The "Add to Favorites" feature is available from most context menus in Navigator and is easy to use. Once you move into Case Manager, however, there is no way to add a case or a case folder to your favorites. In this blog entry, we show a quick script you can use to add the main Case folder to your favorites - from a search result, from a Case Details page, and from a Work Details page.
The main Case Folder provides access to all case properties as well as documents and folders saved into the case. This is particularly helpful for accessing case documents from a mobile device such as an iPhone.
From a Case Details Page
From Case Builder, open the desired solution and navigate to "Pages" tab and the "Case Details Pages" section to the desired page. Open the Settings dialog from the Case Toolbar, navigate to the "Toolbar" tab and add a new Script Action toolbar button and provide a meaningful name such as "Favorite"
Add the following code in the "Execute" block:
getActionContext: Each action in Case Manager - toolbar action, script action, menu action, etc. provides an action context that enables you to access system variables and objects based on when and from where the action was called.
Favorite.createFromItem: The createFromItem method expects a repository Item, and this requires navigating from the ActionContent to the caseFolder object. In the above script, the getActionContent call returns a caseEditable object that we use to access the caseObject and from there the caseFolder.
From a Work Details Page
Following the same process as above, access a "Work Detail" page and, again, select the toolbar Settings dialog and create a new Script Action toolbar button. The difference between the Work Details page and the Case Details script will be due to changes in the ActionContext of the call - calling a script action from a case will return a caseEditable and calling a script action from a work item will return a workItemEditable. The trick will be obtaining a reference to the caseFolder from the workItemEditable. This is shown below.
From a Search Result Context Menu
Working with a search result follows the same overall process with a few small differences. First, rather than creating a toolbar button, we will add the action to the right-click context menu and, second, we will need to handle the possibility that the user selected multiple cases and not just a single case. Luckily, the getActionContext call will return an array of caseObject references making it very easy to create the favorite while looping through all the selected cases. To create the new context menu, select a CaseList widget that you would like to modify. The default "Cases" page in the "Solution Pages" section is a good place to start. Access the Settings dialog, and add a new context menu.
Viewing the Favorites in the Mobile Client
Now that we have created the favorites, the cases and case documents are now available from the Content Navigator mobile client giving your users full access to case properties and documents when they are on the go.