AnsweredAssumed Answered

TaskQuery API not working combined with Assignee and candidate groups

Question asked by swamy2156 on Oct 19, 2017

I am using Activiti 5.21.0 and I have a requirement like get task count which are assigned to an User or Assigned groups which are associated to that User. 

TaskQuery taskQuery = taskService.createTaskQuery()
.or().taskCandidateGroupIn(assigneeGroupIds).taskUnassigned().endOr().taskAssignee("xprk911").active().count();

TaskQuery converted into SQL as follows. It didn't considered userId(i.e xprk911) while generating query. It looks like a bug in query preparation by taskQuery API or Am I making anything wrong in using taskQuery API for my requirement?

 

select count(distinct RES.ID_)
from ACT_RU_TASK RES
inner join ACT_RU_IDENTITYLINK I_OR0
on I_OR0.TASK_ID_ = RES.ID_
WHERE RES.ASSIGNEE_ = ?
  and RES.SUSPENSION_STATE_ = 1
  and (RES.ASSIGNEE_ IS NULL or
          (RES.ASSIGNEE_ is null and I_OR0.TYPE_ = 'candidate' and (I_OR0.GROUP_ID_ IN (?,?))))

Outcomes