07-06-2018 05:04 AM
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?
07-11-2018 08:20 AM
I'm not sure about 5.1.6.4 but in latest version you can modify the assignee of an active task.
07-11-2018 08:41 AM
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.
07-11-2018 08:53 AM
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)
08-03-2018 05:27 AM
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".
08-03-2018 05:39 AM
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.
09-07-2020 11:54 AM
Hi,
In your example you use the method task.setAssignee("newassignee"); I have the same question, but what I have as input is the "ExternalID" of the user, and am struggling to find a way to get the "userId" to use the setter. Is this possible? I mean, to assign a task to someone with ExternalId="xyz" ? Thank you.
Explore our Alfresco products with the links below. Use labels to filter content by product module.