cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to write a taskquery which has the condition like assignee==null OR (taskUnassigned() AND taskCandidateGroupIn(list)). Can anyone help me with this. It would be a great help

kbojewar
Champ in-the-making
Champ in-the-making


taskService.createTaskQuery().or().taskUnassigned().taskAssigned(name).endOr().list();

I was just testing the functioning of or(). But it is behaving weird when I try to run above statement it gives me all the task which are assigned to some name and all the unassigned tasks.

But when I try to run the below command it doent give me the desired result. Can someone help me on this.And how should I include AND and OR in the taskQuery

taskService.createTaskQuery().or().taskUnassigned().taskCandidateGroupIn(roles).endOr().list();

1 REPLY 1

jearles
Star Contributor
Star Contributor

Kaustubh,

It does not seem appear that .taskAssigned(name) is a valid API to call; it appears that what you're looking for, in order for the first query to work is taskCandidateOrAssigned - which selects tasks that have been claimed or assigned to user or waiting to be claimed by user.

The way you're utilizing .or() / .endOr() is correct; .or() is the opening for things that you're trying to or together, and .endOr() is how you close that list.

For your query:
TaskUnassigned should cover all tasks that aren't assigned or claimed. And TaskCandidateGroupIn will return tasks for which the 'candidateGroup' is one of the given groups (or as you've labeled it, 'roles').
What result does it give you?

-JEarles