AnsweredAssumed Answered

Accessing process variable in JavaDelegate task

Question asked by k_kunti@yahoo.com on Mar 11, 2013
Latest reply on Mar 12, 2013 by k_kunti@yahoo.com
Hi All

I am initiating a process with some variables:

   Map<String, Object> variables = new HashMap<String, Object>();
      variables.put("employeeName", "Kermit");
      variables.put("numberOfDays", new Integer(4));
      variables.put("vacationMotivation", "I'm really tired!");

      //inParms.put("inMap", "test");
      
      processEngine.getRuntimeService().startProcessInstanceByKey("SPCallProcess", variables);


And trying to access the variables in the first Task (Java ServiceTask), however getVariableNames() is returning an empty array. but when I am setting some variable in the service task , I am able to access the same in the next service task.

public class CallProcMybatis  implements JavaDelegate{

   @Override
   public void execute(DelegateExecution arg0) throws Exception {

      System.out.println(arg0.getVariableNames());
      
      arg0.setVariable("test", "test");
      arg0.setVariable("test1", "test");

it will be big help if someone can point out where I am going wrong.

Thanks in advance for the help.

Best Regards
Krishnendu

Outcomes