I am not able to get all the tasks under a process id,i get only current task.

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

I am not able to get all the tasks under a process id,i get only current task.

I am creating a process instance from process definition,then i have to set the assignee to two tasks under that process instance(process definition contain two user tasks unassigned),But as i get only one/current task (task 1) under process instance i am not able to set the assignee to task 2 in the process instance.

My requirement is to set assignee dynamically to each process instance created from process definition,and then get list of tasks for the assignee set previously.

1 Reply
Highlighted
Alfresco Employee

Re: I am not able to get all the tasks under a process id,i get only current task.

So you mean that you are able to set the assignee of the task as process execution reaches that task (perhaps by using an expression in the assignee such as in activiti - Dynamically setting user task assignee - Stack Overflow ) but you're not able to set the assignee for task that are inactive because process execution has not reached them yet? If so that sounds like normal behaviour. One idea to approach this would be to record who you intend to assign the task to when process does reach it. You could store the intended assignee in a process variable using a name like 'task2Assignee'. Then you could query for process instances with a particular user assigned using runtimeSerivice.createProcessInstanceQuery().variableValueEquals("task2Assignee", user) or you could query for the full list and set the includeProcessVariables option so that the result includes details of your intended assignee.

I presume you don't have a problem with finding out what tasks there are as it seems like you don't need to find that out dynamically (but if you did you could do so as per java - Is there a way to get tasks in Activiti process definition without creating a process instanc... ).