cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-user approval task

vprince
Champ in-the-making
Champ in-the-making
I am trying to have an Approval user task that will require 2 different users in a candidate group to approve it. When I set Cardinality = 2, Multi-instance type = Sequential and Assignee to a candidate group, the same approver is able to claim the task both the times. Is there a clean way that will allow me to specify a candidate group but prevent the same user from claiming the task twice?
4 REPLIES 4

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Implement logic to check whether one of the tasks is already claimed by the user. (I am not sure whether there is an event to which you can listen to (e.g. TASK_CLAIMED) - if there is not just add it to the engine.) You can put this logic into this listener.

Regards
Martin

daifengwei
Champ in-the-making
Champ in-the-making
hi,
as far as I remember once "claim" method of task service get called, (assume you have implemented a task listener for event "assignment"), the listener (notify method) will be called. inside listener method "notify" you can check who try to claim this task, if she claimed the task before, an exception should be thrown in order to abort the operation. so how to know if she claimed the task before? you need to keep a list of users who claimed the task before in a process variable (let's call it "participants"). if she doesn't claim this task before, her user id should be saved in "participants" process variable for later use. hope this helps.

vprince
Champ in-the-making
Champ in-the-making
Thanks for your responses. I was trying to prevent the second task instance from ever showing up in the queue of the user who has already approved this task. If he/she does not see it again in their queue, there is little chance for them to be confused as to why it is reappearing.

daifengwei
Champ in-the-making
Champ in-the-making
that's what candidate user/group is for.

when someone claims a user task (assume it is the first user task in 4 eyes validation process), user task's listener (event assignment) will be triggered, in the listener you should grab the assignee of this task and save it somewhere (let's call it "approver1"). when the second user task comes to the picture, you should set its candidate's user/group without "approver1", it can be easliy achieved by Activiti Expression (means that candidate user/group is dynamically set).