Reputation: 38985
I am using flowable 7 as the workflow engine, now I need to use multiple process id to to a in query. From the flowable source I did not found the processdefinitionIdIn function, just have this query:
taskService.createTaskQuery().processDefinitionId(processInstanceId);
could I use this way to do a in query to fond task from multiple process definition id?
taskService.createTaskQuery().processDefinitionId(processDefinitionId1).or().processDefinitionId(processDefinitionId2)
is that a good practice?
Upvotes: -1
Views: 80
Reputation: 361
This won't return tasks for either of the process instances, since you need to use .or()
always together with .endOr()
. Between those you can then have the different methods to be called which should be combined with an or, e.g.:
taskService.createTaskQuery()
.or()
.processDefinitionId(processDefinitionId1)
.processInstanceId(processInstanceId)
.endOr()
.list()
However, when you call now .processDefinitionId(...)
twice inside the .or()
, it will overwrite the previous process definition id and only find the tasks to last process definitions.
In case you are searching for the same process in different versions, I would suggest to use the .processDefinitionKey(...)
.
If you are searching within the same deployment and multiple process definitions, you can consider combining the .processDefinitionKeyIn(...)
with the .deploymentId(...)
.
Upvotes: 1