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?
I'm not sure about 5.1.6.4 but in latest version you can modify the assignee 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.
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)
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".
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.
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.
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.