IBM Support

How do I programmatically start a discretionary task from a toolbar button?

Technical Blog Post


Abstract

How do I programmatically start a discretionary task from a toolbar button?

Body

Discretionary tasks allow case workers to add additional tasks to a case on the fly. In the standard Case Client user interface, an Add Task button displays a dialog that allows the end user to select one of the case's discretionary tasks from a menu, give it a unique name if desired, and click OK.

For discretionary tasks that are commonly added to a case, a more direct approach with less clicks might be more appropriate.

image

Here is how you can add a new toolbar button to a case details page that does just that.

  • On the case details page, add a new Script Action toolbar button to the toolbar widget by clicking its settings icon
  • Name the button with the name of the discretionary task
  • Enter the following script, modifying the name of the task to match a discretionary task in the solution
  var caseEditable = this.getActionContext("Case")[0];  var solution = caseEditable.caseObject.caseType.getSolution();  var prefix = solution.getPrefix();  var theCaseID = caseEditable.getCaseTitle();    /* Modify this line to match the internal name of a task in your solution */  var taskType = prefix + "_MeetingRequest";    callback=function(taskEditable){    /* Modify this line to set the task name that appears in the Task List. It can be anything you want  */       taskEditable.setTaskName("Meeting Re: " + theCaseID);         var addTaskPagePayload = {            "taskEditable": taskEditable,            "coordination": new icm.util.Coordination()       };       this.broadcastEvent("icm.AddTask", addTaskPagePayload);  };  caseEditable.caseObject.createNewTaskEditable(taskType, dojo.hitch(this,callback));

 

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

ibm11280680