Re: 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
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?