REST API: Search tasks assigned to multiple actors/groups


#1

Hey,

I have a user that is a member of few groups,
I’d like to search all tasks that belongs to any of these groups using the tasks post query api but seems like the “or” operator is not supported,

Any idea?

Thanks.


#2

Check out the candidateGroups parameter.

Cheers,
Thorben


#3

I’ll rephrase the problem, maybe the example wasn’t good enough,

I’d like to search in multiple conditions such “all tasks belong to user or in candidateUser”, for example:

assignee eq “foo” or “candidateUser” eq “foo”.

thanks.


#4

OR queries are only available from 7.8 onwards, see the parameter orQueries in https://docs.camunda.org/manual/7.8/reference/rest/task/post-query/.

Cheers,
Thorben


#5

Nice, except that exactly what we need is or criteria on candidateUser and candidateGroups,

Any reason why specifically these attributes aren’t supported ?

thanks.


#6

While withCandidateUsers is not supported, candidateUser is. Same for groups. I don’t know why it is this way at this point.


#7

Hi,
is there a way to do
assignee eq “foo” or assignee eq “bar”.

here:
https://docs.camunda.org/manual/7.8/user-guide/process-engine/process-engine-api/#or-queries

it says that the same parameter overrides the previous one, and I don’t see an “assigneeIn” option.
Is there any other way?

Thanks.


#8

Hello, I have stumbled upon same problem myself, I just need to select tasks for enumeration of candidateusers in one select. It is possible to do it via java api, however it is not possible to make such select with rest API. Although the documentation states that it is possilble to repeat the same attribute, in the way it is programmed, it effectively causes to select nothing, because if you repeat the same attribute, it everytime means ‘and’.

Any idea how to do or without needing to make custom rest endpoint?


#9

Hi @tomorrow,

Could you please share what you’ve tried with both APIs - Java (you say it is working) and Rest.

Best regards,
Yana


#10

Hello, sorry for misleading, I thought colleague of me tried it, but he didn’t. It obviously works only for task variables that way.

So, for java API is there any way to do candidateUserIn, assigneeIn type of select same as it is for e.g. taskCandidateGroupIn. By studying the api, it is not.

As far as REST API is concerened, its very strange, thate candidateGroupIn criteria is not present, even though some others, e.g. tenantIdIn is.

These are a very strange disproportion. Is there any reason for it? I would like to avoid needing to write my own custom select for basic functionality as this. I already have some custom queries and it is a little bit pain in the ass when performing the upgrade of camunda, because I need to copy&paste standard camunda select and add only this specific part, which means if the select changes in camunda, I need to changed it in my custom select too. So I want to minimize the number of such custom task query selects.


#11

Hi @tomorrow,

The engine doesn’t have such functionality, you can vote for the already open CAM-4670 issue or consider providing a pull request.
Another option is to use native query which you need to create by your self to suits your needs.
For more information please check the User guide of our docs.

Best regards,
Yana


#12

yup, but the feature request is for assignee, I need candidateUserIn currently. Should I create new feature request or should the already created request be edited?


#13

Feel free to create a new one.