I have a task that could either belong to a process or a case. I am able to get processInstanceId for a task. How can I get caseInstanceId for a given task?
Hi Akailto.
org.flowable.task.api.TaskInfo
/**
* Reference to a scope identifier or null if none is set (e.g. for bpmn process task it is null)
*/
String getScopeId();
/**
* Reference to a sub scope identifier or null if none is set (e.g. for bpmn process task it is null)
*/
String getSubScopeId();
/**
* Reference to a scope type or null if none is set (e.g. for bpmn process task it is null)
*/
String getScopeType();
Regards
Martin
1 Like
Hi Martin,
If I use task query as TaskQuery::includeProcessVariables then getScopeId() method returns null.
Hi,
could you reproduce the issue in the jUnit test?
It seems like a bug which can be easily fixed. (You can even provide a fix)
Regards
Martin
Hi Martin,
I am using
TaskQuery query = processEngine.getTaskService().createTaskQuery().includeProcessVariables();
This query does not load the ScopeId.
Regards
That’s because you’re requesting process variables. There’s no such thing for cases, you’d need to do two queries (2nd one using the case instance id).
1 Like