cancel
Showing results for 
Search instead for 
Did you mean: 

get finished process instances which involved a user

fatma19
Confirmed Champ
Confirmed Champ

i am currently trying to get finished process Instances with  processDefinitionKey("courriersArrivés") and i want to check which process instances involved the user with id "ha".
when i type this 
System.out.println( historyService.createHistoricProcessInstanceQuery().processDefinitionKey("courriersArrivés").involvedUser("ha").finished().list().size());
i always got 0 😕 even i am sure that i have tasks whcih where assigned to "ha" because when the process is runnig ha recieve its tasks,but when it is finished i face this problem

So how to do that in activiti ? 

Thank's in advanced Smiley Happy

3 REPLIES 3

gdharley
Elite Collaborator
Elite Collaborator

An involved user is nit the same as an assignee or candidate.

Check out the following thread:
 

Greg

i have already mention "ha" as a candidate in  groupe  "Bureau d'ordre",and this is how i assigned th task

taskService.addCandidateGroup(
taskService.createTaskQuery().processInstanceId(processInstance.getId()).list().get(0).getId(),
"Bureau d'ordre");

daisuke-yoshimo
Star Collaborator
Star Collaborator

You should use TaskService.addCandidateUser, not TaskService.addCandidateGroup.
If you use only TaskService.addCandidateGroup, act_hi_identitylink has only a groupId.

If you use TaskService.addCandidateGroup, act_hi_identitylink has a userId and you can use involvedUser option.