Search criteria (Candidate User & Candidate Group)

Hello,

I tried to set the search criteria both candidate User & candidate Group.

It occurs an error with this message.
(Invalid query usage: cannot set both candidateUser and candidateGroup)

But in Task.xml, the code was designed by using ‘OR’, not ‘AND’ between candidate User & candidate Group.

Please let me know what this code means.

Thank you.

(Task.xml)
< if test=“candidateUser != null || candidateGroups != null”>
< if test=“!includeAssignedTasks”>
and RES.ASSIGNEE_ is null
< /if>
and I.TYPE_ = ‘candidate’
and
(
< if test=“candidateUser != null”>
I.USER_ID_ = #{candidateUser}
< /if>
< if test=“candidateUser != null && candidateGroups != null && candidateGroups.size() > 0”>
or
< /if>
< if test=“candidateGroups != null && candidateGroups.size() > 0”>
I.GROUP_ID_ IN
< foreach item=“group” index=“index” collection=“candidateGroups” open=“(” separator=“,” close=“)”>
#{group}
< /foreach>
< /if>
)
< /if>

If I am not mistaken, the task query performs an AND operation for all specified criteria, including candidate user and group. The code snippet you posted constructs the SQL for that query.

As the question is related to the query execution, I move it to the Process Engine category.