REST API: Search tasks assigned to multiple actors/groups

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.

Check out the candidateGroups parameter.

Cheers,
Thorben

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.

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

1 Like

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

Any reason why specifically these attributes aren’t supported ?

thanks.

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

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.

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?

Hi @tomorrow,

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

Best regards,
Yana

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.

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

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?

Feel free to create a new one.

Hello, just today I was studying the code in TaskQuery as preparation for adding taskCandidateUserIn criteria and I noticed one thing.

It seems(also according the documentation javadoc) that if or query is active, then the implicit filling of his candidateGroups is turned of, which is a little misleading.

Why is it implemented like this? This functionality provided good separation of concerns, because client application using camunda process engine application has and should have no idea, what are the groups assigned to given users inside the camunda process engine.