Query format to join tasks withoutCandidateGroups and taskCandidateGroupIn

Hi folks,

I have this scenario:

  • I have some tasks, ones has CandidateGroup defined, and others not, and I want to get the tasks that are assigned to specific groups and the ones that still doesn’t have any group assigned.

I can get ones, or the others, but unfortunately can’t combine both in the same query.

Do you know how can combine both to get the tasks that has its candidateGroup in the provided list (taskCandidateGroupIn(groupsList)) + the tasks that doesn’t have candidateGroup assigned yet (withoutCandidateGroups())?

// Solution 1 - partially works as expected 
// (retrieved **just the tasks with assigned candidateGroup**)
query.taskCandidateGroupIn(groupsList);
query.includeAssignedTasks();

// Solution 2 - partially works as expected 
// (retrieved **just the tasks without candidateGroup**)
query.withoutCandidateGroups();
query.includeAssignedTasks();

Now, trying to combine the previous both, NONE of the following sol.lutions worked for me

// Solution 3 - **NONE of the task are retrieved**
query.withoutCandidateGroups();
query.or().taskCandidateGroupIn(groupsList).endOr();
query.includeAssignedTasks();
// Solution 4 - **NONE of the task are retrieved**
query.withoutCandidateGroups();
query.or().taskCandidateGroupIn(groupsList).includeAssignedTasks().endOr();

// Solution 5 - **NONE of the task are retrieved**
query.withoutCandidateGroups();
query.taskCandidateGroupIn(groupsList);
query.includeAssignedTasks();

// Solution 6 - **NONE of the task are retrieved**
query.taskCandidateGroupIn(groupsList);
query.includeAssignedTasks();
query.withoutCandidateGroups();

// Solution 7 - **NONE of the task are retrieved**
query.taskCandidateGroupIn(groupsList);
query.withoutCandidateGroups();
query.includeAssignedTasks();

// Solution 8 - **ProcessEngineException:** Invalid query usage: 
// cannot set withoutCandidateGroups() within 'or' query
query.taskCandidateGroupIn(groupsList).or().query.withoutCandidateGroups().endOr();
query.includeAssignedTasks();

Thank you in advance.