Execution query returns null while execution id exists

cancel
Showing results for 
Search instead for 
Did you mean: 
vincent-kali
Established Member

Execution query returns null while execution id exists

I'm runing acitivi in Alfresco ce 5.2.g.
I'm using an activiti expression to resolve assignee group at runtime for my user tasks.
This expression is calling a Java class and 'execution.getId()' is passed as parameter in bpmn file:
<userTask id="myTaskName" name="My Task Name" activiti:candidateGroups="${candidateChecker.GetCandidateGroup(execution.getId())}" activiti:formKey="myNameSpace:myLocalTask">

The issue:
I can't get Execution instance in my Java Class from this execution id, query returns null value.
But I can successfully get execution variable using the same execution id (-> id is a valid execution id)

Any idea ?

public class CandidateChecker implements org.springframework.context.ApplicationContextAware {

....

public String GetCandidateGroup(String executionId) {

// execution is null
Execution execution = processEngine.getRuntimeService().createExecutionQuery().executionId(executionId).singleResult();

// myVarValue is correctly retrieved
Object myVarValue = processEngine.getRuntimeService().getVariable(executionId, myVar);