AnsweredAssumed Answered

Access Variables in Call Activity

Question asked by c.heckmann on Jul 7, 2011
Latest reply on Jul 11, 2011 by jbarrez
Hi,

I modelled a process with one subprocess using activiti. In a task in the parent process I put a variable to the Process variables the following way:

Map<String, Object> variablesMap = exc.getVariables();
variablesMap.put("ParentProcessVar", var);

I now tried to pass this variable from the parent process into the sub process. I implemented the parameter passing using the following snippet of code:

<callActivity id="callactivity1" name="adsubProcess" calledElement="CalledElement">
      <extensionElements>
        <activiti:in source="ParentProcessVar" target="SubProcessVar"></activiti:in>
        <activiti:out source="SubProcessVar" target="ParentProcessVar"></activiti:out>
      </extensionElements>    
    </callActivity>

Within a Task in the subprocess I try to access the variable in the following way:

Map<String, Object> variablesMap = exc.getVariables();
String var= (String) variablesMap.get("SubProcessVar");

Sadly this throws a NullPointerException:

07.07.2011 18:38:09 org.activiti.engine.impl.interceptor.CommandContext close
SCHWERWIEGEND: Error while closing command context
java.lang.NullPointerException

I tried everything I could imagine and hope somebody here has a solution for this problem. Probably I am just missing out one small detail.

Thanks & Best Regards,
Carl

Outcomes