Find Execution Id from a variable saved in it

Hi All,

I’m trying to find the execution id from a variable stored in a process instance. I have tried so far,


But this seems to be giving null result. I have set the variable to the delegateExecution in a previous step
delegateExecution.setVariable("id", "123");

Any reason why this does not work?


Could you try it this way?

ProcessInstance procInst = runtimeService.createProcessInstanceQuery().includeProcessVariables().variableValueEquals("id", "123").singleResult();
Execution exec = runtimeService.createExecutionQuery().activityId(procInst.getActivityId()).singleResult();
//do stuff with "exec" object