cancel
Showing results for 
Search instead for 
Did you mean: 

Get User Who Completed a Task

akirapix
Champ in-the-making
Champ in-the-making
Hi Everybody,
i am trying to use activiti engine in my company but i am still stuck trying to accomplish simple tasks.
I love using ScriptTask with Javascript as language. One thing i need to do is to know which user completed a task (assigned to candidateGroups or candidateUsers). I followed this thread  http://forums.activiti.org/content/how-get-who-completed-task using solution suggested by ismail:

<activiti:taskListener event="complete" class="org.activiti.engine.impl.bpmn.listener.ScriptTaskListener">
    <activiti:field name="script">
        <activiti:string>
                var approvingManager = task.assignee;                  
                approvingManager // implicit return value
        </activiti:string>
     </activiti:field>
     <activiti:field name="language" stringValue="javascript" />
     <activiti:field name="resultVariable" stringValue="approvingManager"  />
</activiti:taskListener>

The first time i complete my task i correctly get user who completed the task (ie: user1 of group Group1). If the workflow goes on and the task is completed by another user of Group1 (ie: user2) i see that approvingManager valu is still "user1"

Is there a simple way to accomplish such task? 
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Could you create jUnit test for your case?
http://forums.activiti.org/content/sticky-how-write-unit-test

Regards
Martin