AnsweredAssumed Answered

Get User Who Completed a Task

Question asked by akirapix on Dec 19, 2014
Latest reply on Dec 22, 2014 by martin.grofcik
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? 

Outcomes