Is it possible to use or conditions in Search tasks API V1 to retrieve tasks for candidateGroups or candidateUsers or assignee?

I have a requirement to retrieve all process instances that are active from all process definitions and related to the current user.

the relation may be:

candidateGroups
or candidateUsers
or assignee
So I want to make a query like the following but with OR operator:


{
 "state": "CREATED", 
 "candidateGroups": ["mygroup1","myGroup2"],
 "assignee":"myUser1",
 "candidateUsers": ["myUser1","myUser2"] 
}

How to do that in V1 search-tasks ?

and unfortunatley I am still using v1 because v2 doesn’t have includeVariables yet, and includeVariables is Mandatory for me.

Hi @devmsaleh,

Unfortunately, the Tasklist API v1 does not support OR conditions across different filter types like candidateGroups, candidateUsers, and assignee.

Current Behavior

The API works with AND conditions between different filter types:

  • If you specify both candidateGroups and assignee, it will return tasks that match BOTH conditions
  • Within the same filter type (e.g., multiple candidate groups), it works as OR

What You Can Do

Since Camunda 8.5.0-alpha2, the API supports multiple values within the same filter type:

{
  "state": "CREATED",
  "candidateGroups": ["mygroup1", "myGroup2"],
  "candidateUsers": ["myUser1", "myUser2"],
  "assignees": ["myUser1"]
}

But this still uses AND logic between the different types.

Workaround for OR Logic

To achieve your requirement of finding tasks where the user is related through any of these relationships, you’ll need to:

  1. Make separate API calls for each condition:

    • Call 1: {"state": "CREATED", "candidateGroups": ["mygroup1","myGroup2"]}
    • Call 2: {"state": "CREATED", "candidateUsers": ["myUser1","myUser2"]}
    • Call 3: {"state": "CREATED", "assignee": "myUser1"}
  2. Merge and deduplicate the results client-side based on task IDs

Alternative Consideration

You mentioned staying on v1 for includeVariables. You might want to check if the newer API versions have added this feature, as the API is actively being developed.

References:

Hope this helps! Let me know if you need clarification on implementing the workaround.