IBM Support

How to implement custom Last User routing or single person assignment

Question & Answer


Question

How to implement custom Last User routing or single person assignment

Answer

On Demand Consulting
Author: Mikhail Zilbergleyt

In some situation, it is necessary to assign a task to a specific user.

Starting with BPM 8.5, with introduction of teams, team filter may be the solution.  If team filter returns a team of 1 user, the user gets automatically assigned to that task.
Although this method works, it has several limitations: The work around for the above limitations is to use task.reassignTo() function to assign a specific user right after the task is created.  The limitation of this method is the fact that entire team receives new task notification emails ( if notification is enabled for the user in their user profile ).

The solution is illustrated in the attached process application which is build on BPM 8.5.6.

Here is the high level implementation steps:
  1. Capture the user to assign next task in the private variable.  For example:  Post Assginment:  tw.local.lastUserName = tw.system.user.name
    Best practice not to store user.id on instance variables.
  2. Create a timer event ( don't interrupt the activity ) on the next human task.  Set it to fire right away after start of step
  3. Create a Server File with the assign function (Note: the logic can be implemented in the JavaScript activity directly on the BPD as well ).  For example:
var systemUserName = "bpmadmin"  // if the prev human task has been interrupted by either a timer or IME the tw.system.user.name captured in step 1) would be the system lane user.

var reasignTaskById = function( taskId userName )
{
     // keep original assignment if userName not set or system lane user
     if ( userName != systemUserName || userName == null || userName == undefined )
     {
          var task = tw.system.findTaskByID(taskId)
          task.reassignTo(tw.system.org.findUserByName(userName));
     }    
     return taskId;
}
  1. Create a private variable noOpVar of type String
  2. in the Post Assignment of the timer set tw.local.noOpVar = reasignTaskById( tw.system.step.task.id tw.local.lastUserName )

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSQTW3","label":"IBM On Demand Consulting for Hybrid Cloud"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

More support for:
IBM On Demand Consulting for Hybrid Cloud

Software version:
All Versions

Document number:
776439

Modified date:
17 March 2019

UID

ibm10776439

Manage My Notification Subscriptions