AnsweredAssumed Answered

Referring to task local variable in expression (activiti 5.16.3)

Question asked by raka on Oct 8, 2014
Latest reply on Oct 9, 2014 by martin.grofcik
Hi,

I have a conditional transition from userTask1 to userTask2. My tasks definition:

<userTask id="userTask1" name="User Task 1" activiti:owner="kermit">
      <extensionElements>
        <activiti:formProperty id="varA" name="varA" type="string"/>
      </extensionElements>
    </userTask>
    <userTask id="userTask2" name="User Task 2" activiti:owner="piggy">
      <extensionElements>
        <activiti:formProperty id="varB" name="varB" type="string"/>
      </extensionElements>
    </userTask>

I used the following expression in the bpmn file: <conditionExpression xsi:type="tFormalExpression"><![CDATA[${userTask1.varA == "uTask2"}]]></conditionExpression>

When I mark the userTask1 as "completed", I use the following method in the Java API:


Map<String, Object> variableMap = new HashMap<String, Object>();
variableMap.put("varA", "1");
activitiRule.getTaskService().complete(tasks.get(0).getId(), variableMap, true);


Notice the "true" param at the end, this is to say that those variables are local to the task.

In a separate test I could verify that the the variable is indeed stored locally to the task.

But, in this test (with the conditional transition), I'm getting this error:

—-
org.activiti.engine.ActivitiException: Unknown property used in expression: ${userTask1.varA == "uTask2"}
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:53)
        ….
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'userTask1'
—-

How to solve this?

Thanks,
Raka

Outcomes