Task Query by list of tasks id


I need to easely get list of tasks by ids. How it could be done (with java api) ?

I already saw this TaskQuery for tasks of several processes and read this https://docs.camunda.org/manual/7.13/user-guide/process-engine/process-engine-api/#or-queries

But i did not manage to make it work (no taskIdIn like taskCandidateGroupIn).

Thanks !

I did not try this, but my understanding from the docs is, that this should work:

List<Task> tasks = this.taskService.createTaskQuery().or().taskId( "id1" ).taskId( "id2" ).....endOr().list();

Tasks with id1 or id2 or … will be retrieved.

I’ve just tested this : List<Task> tasks = this.taskService.createTaskQuery().or().taskId("f421d0a1-b23c-11ea-b79f-005056913223").taskId("0f75f84d-b23d-11ea-b79f-005056913223").endOr().list();

I only get the last task … as explained here https://docs.camunda.org/manual/7.13/user-guide/process-engine/process-engine-api/#or-queries

Whenever a non-variable-filter-criterion is used more than once inside a query, only the value which was applied last is utilized