AnsweredAssumed Answered

How to get process variables in a taskListener?

Question asked by c-shark on May 9, 2014
Latest reply on May 12, 2014 by c-shark
Hi!
I've got the following in my bpmn:

    <userTask id="assembleContract" name="Assemble Contract" activiti:candidateGroups="${candidateGroups}">
      <documentation>doc…</documentation>
      <extensionElements>
        <activiti:taskListener event="create" expression="${orgContractRegService.createOrganizationAndProfile(task)}"></activiti:taskListener>
      </extensionElements>
    </userTask>


And the corresponding java code:

  public void createOrganizationAndProfile(DelegateTask task) throws Exception {
    LOGGER.info("Executing createOrganizationAndProfile() listener");
    task.getVariable("organization"); //null
  }


The problem is that I can't get process variables in the listener. Interesting fact: the getVariableNames() is successful, I got back the variable names (but only the names…).
It doesn't work even when I give execution as parameter instead of task.
It works fine when I run it as a Service Task.

Can anyone help?
Thanks

Outcomes