Modifying users of an active task

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

Modifying users of an active task

Hi, I have a requirement where I want to remove/add/update the assignee's of an active task. The assignee which i want to modify could also be in pending state. I am using 5.16.4 version of Activiti.

My question is, it is possible to do in 5.16.4 version of Activiti, if not, is such feature added in latest version?

5 Replies
bassam_al-saror
Senior Member

Re: Modifying users of an active task

I'm not sure about 5.1.6.4 but in latest version you can modify the assignee of an active task.

khushboo_gupta1
Member II

Re: Modifying users of an active task

So, in the latest version, is it possible to add/remove or replace an assignee from an active task?

If yes, can you please point to some examples on how it can be done.

bassam_al-saror
Senior Member

Re: Modifying users of an active task

You can call the TaskService set assignee method.

TaskService (Activiti - Engine 5.22.0 API) 

Or you can get the task and update it's assignee and save the changes

Task task = taskService.createTaskQuery().taskId("123").singleResult();

task.setAssignee("newassignee");

taskService.save(task);

You can set to null if you want to unset the assignee. And in case of claimed tasks you can use TaskService (Activiti - Engine 5.22.0 API) 

khushboo_gupta1
Member II

Re: Modifying users of an active task

Thanks Bassam, 

I have one more question - "How can I achieve this for a multi-user task". Suppose there are three assignees in a currently active sequential task :  "User1", "User2", "User3". Of which, User1 is currently active and I want to remove "User1" and "User2" and add new assignee "User4". 

bassam_al-saror
Senior Member

Re: Modifying users of an active task

If the user tasks have already been created then it will be the same approach querying for those tasks and updating their assignees. If you are talking about user tasks that haven't been created yet that's something different.