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 solution is illustrated in the attached process application which is build on BPM 8.5.6.
Here is the high level implementation steps:
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:
- With Team of 1, there is no way to assign Task to another team member, unless the user is team manager or admin
- If the task is reassigned to a user outside of the filtered team, the next task with "Last User in Team" routing policy may not work as expected, if the last user is NOT member of the
team or filtered team on the current task. See JR52861: TASK ASSIGNMENT WITH LAST USER DISTRIBUTION SET MIGHT NOT WORK WHEN TEAM FILTER SERVICES ARE USED for details.
The solution is illustrated in the attached process application which is build on BPM 8.5.6.
Here is the high level implementation steps:
- 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. - Create a timer event ( don't interrupt the activity ) on the next human task. Set it to fire right away after start of step
- 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;
}
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;
}
- Create a private variable noOpVar of type String
- 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":""}}]
Was this topic helpful?
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