1
votes

I have a requirement to dynamically set the assignee to tasks of process instance created from a process definition id.So,i get my assignee values from UI side and submitted for approval workflow.Now i will start the process and assign those assignee to the respective tasks.The problem is i get only one task on start of process as activiti gives only the current tasks/active tasks.As i don't get rest of task list i am unable to set the assignee to those tasks. I also have to find pending tasks and completed tasks for a assignee from process instance,as there is query for task which i can use but as i am not able to set the assignee for all tasks ,this query seems not much of help for me. So how can i get all tasks under a process instance and set the assignee to each user tasks and then complete the user tasks whenever needed using process instance and task query.

Below is my workflow

Workflow describing above scenario

1

1 Answers

1
votes

To leverage the full power of the process engine, you would not pass runtime information at process start, you would dynamically determine the assignee at runtime, by using a taskListener on the „create“ event.

But if you have to stick to your approach: put the assignees in a map with the taskDefinitionKey As key and pass that map to the process instance as process variables.

Afterwards, in your Bpmn model use „${taskDefintionKey}“ in the assigned field (taskdefkey being the I’d of your user task of course).