cancel
Showing results for 
Search instead for 
Did you mean: 

Access Variables in Call Activity

c_heckmann
Champ in-the-making
Champ in-the-making
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
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
That should be it. There must indeed be some small detail … could you create a minimal unit test that shows the problem?