cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing process variable in JavaDelegate task

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

k_kunti
Champ in-the-making
Champ in-the-making
Dear All

Its my mistake , it works as expected.

I had two files by the same name in eclipse in 2 different project and all the while I was running the wrong file.

My apologies for posting  a wrong issue.

Thank you
Best Regards
Krishnendu