Getting same results when i assigned tasks differently

cancel
Showing results for 
Search instead for 
Did you mean: 
vamsinipun
Established Member

Getting same results when i assigned tasks differently

Hi,

   I am using activiti in my spring web application. Here I assigned task to particular group not to candidate user. Now, i need to display candidate user tasks and groups tasks individually. But both are coming with same tasks.

taskService.createTaskQuery().taskCandidateUser(user.getUsername()).list()

taskService.createTaskQuery().taskCandidateGroup(groupType).list()

I assigned only to group. why candidateUser also returns same tasks? Please let me know if anyone know about this.

Thanks

1 Reply
ryandawson
Alfresco Employee

Re: Getting same results when i assigned tasks differently

This is indeed the intended behaviour - if the user is a member of a group then they are automatically a candidate for any tasks for which the group is a candidate and the taskCandidateUser query will reflect that. You can see how this is implemented by looking at Activiti/TaskQueryImpl.java at 6.x · Activiti/Activiti · GitHub  and Activiti/Task.xml at 6.x · Activiti/Activiti · GitHub - the method is automatically called in virtue of the mybatis config. You can find more explanation and a solution using a native SQL query in the thread getting a user's candidate tasks without the user's group tasks