IBM Support

Something New on the Menu with IBM Case Manager

Technical Blog Post


Abstract

Something New on the Menu with IBM Case Manager

Body

Have you ever gone to your favourite restaurant and the dish you were craving was not on the menu? You could always go with what is there, but that's not why it is your go-to place. You politely ask your server if the chef could perhaps prepare the dish in question given that the necessary ingredients appear in other items. His answer is "Of course! The Chef is always happy to experiment and create exactly what you desire if we have what is needed." Right answer...

 

Today, my fine reader, you are a customer in the Case Manager Cafe. The other day, you heard that the Navigator Bar and Grill had a fantastic new menu item called Edit in Desktop Apps; something that sounded so enticing that you knew you had to try it.

 

Unfortunately, the Navigator Bar and Grill is not where you usually spent your time. The Case Manager Cafe is right next to where you work.

You find a familiar case, open it, right-click on a document and scan the menu. Oh no! the Edit menu is not there at all! Are you to go home unsatisfied?

 

Fortunately I get to play Chef today and cook up that menu item. Even better, I'm going to prepare it right before your eyes! Let's begin.

 

When you are looking at the Case Information widget's settings in the Case Builder Page Editor, you will see that you can add and remove items from the right-click and toolbar menus that are displayed for a document filed in you case. In this situation, the Edit in Desktop Apps or Edit in Office Online do not appear (yet). We know those actions are available in the new IBM Content Navigator 3.0.1; the version that comes with ICM 5.3.1. The trick is knowing how to call them.

ICM has two handy utility menu and toolbar actions called Script Action and Event Action. The former lets you write javascript directly in the menu item. The latter lets you wire an event to something like a Script Adapter to kick off some more events. We are going to use the Script Action for our menu item.

 

image
 

  • Click the Add Submenu icon and name your new item Edit. We want to place our our item in a hierarchical menu the same way Navigator does. 
  • Select your new Edit submenu and click the Add Submenu Item icon
  • From the Actions dropdown, choose the Script Action item
  • Paste the following script into the Execute section
  var actJson = icm.widget.menu.MenuManager.actions["EditWithNativeApplication"];  if (actJson) {     var actionCls = actJson.actionModelClass;     if (actionCls) {        actionCls = dojo.require(actJson.actionModelClass);  } else {     actionCls = ecm.model.Action;  };  var actionObj = new actionCls(actJson);  if (actionObj) {     var docList = this.getActionContext("Document");     if (docList && docList.length > 0)        actionObj.performAction (docList[0].repository, docList);        };  };

image

 

And you were expecting something much more complicated right? Come on, you know me much better than that by now!

But wait, what great creation is complete without a few morsels à la carte? The Script Action also includes sections where you can round out your courses and enter script that controls the item's visibility and enabled state. Let's start by doing a bit of factoring. Replace your original execute script with the following.

 
  if (this._actionObj) {     var docList = this.getActionContext("Document");     if (docList && docList.length > 0)        this._actionObj.performAction (docList[0].repository, docList);  };
 

For the item's visibility you want to ensure that the Edit Services are enabled for the user's desktop and repository. If not, trying to perform the action will fail. Here is the script that will do the test. This is also the first entry point into our scripts so it is where we will instantiate and store our action object for efficiency.

  if (!this._actionObj) {     var actJson = icm.widget.menu.MenuManager.actions["EditWithNativeApplication"];
     if (actJson) {        var actionCls = actJson.actionModelClass;        if (actionCls) {           actionCls = dojo.require(actJson.actionModelClass);        } else {           actionCls = ecm.model.Action;        };        this._actionObj = new actionCls(actJson);        };  };  if (this._actionObj) {     var docList = this.getActionContext("Document");     return this._actionObj.isVisible(docList[0].repository, docList);  };

Finally, we want to test that the user has actually selected a document before we perform the action. This will control the enabled state.

  var docs = this.getActionContext("Document");  return (docs && docs.length && docs.length > 0);

That's all there is to it. You can find the Action IDs of other Navigator menu items by going to the Navigator Settings area, selecting the Menu section and clicking on any menu item that is in one of the lists.

image

So there before you is the very thing you were craving.

 

 

image

 

For those of you that already have Navigator Action Plug-ins that you have written and want to get those to show up in ICM, here is a post from one of our readers that explains a quick way to do just that.

 

Bon appétite mes amis!

 

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

ibm11280650