assign human task multiple users


In bonita how do i assign a human task to multiple users ?

eg. suppose there is a task that needed to be approved by an 'approver'. In our case it is any of the three 'approvers'. how do i assign a task to the three approvers and the first to pick it up, approves it. how do i achieve this ?

1 answer

This one is the BEST answer!

You would have an Actor Filter that specifies the users that would do the task.

The actor filter can be made of of groups, roles or custom data as required.

See here:



Submitted by kaykay on Sun, 08/02/2015 - 13:39

Can this be achieved by API ? Can we dynamically assign task to a group of people using the api ?


Submitted by Sean McP on Sun, 08/02/2015 - 15:17

well sort of, and I'm sure there is another way - but I use this...

  1. startProcess(long, long) - Method in interface org.bonitasoft.engine.api.ProcessRuntimeAPI
  2. Start an instance of the process with the specified process definition id on behalf of a given user.

We also use this:

  1. startProcess()
  2. assignUserTask() Assign a task to a user with given user identifier.

Don't forget to "remove" the case from the others when someone takes ownership of the task.

see the Javadoc documentation here:

  1. startProcess
  2. ProcessInstance startProcess(long userId,
  3. long processDefinitionId)
  4. throws UserNotFoundException,
  5. ProcessDefinitionNotFoundException,
  6. ProcessActivationException,
  7. ProcessExecutionException
  8. Start an instance of the process with the specified process definition id on behalf of a given user.
  9. Parameters:
  10. userId - The user id of the user.
  11. processDefinitionId - The identifier of the process definition for which an instance will be started.
  12. Returns:
  13. An instance of the process.
  14. Throws:
  15. UserNotFoundException - If the given user does not exist.
  16. ProcessDefinitionNotFoundException - If no matching process definition is found.
  17. ProcessActivationException - If a problem occurs when starting the process.
  18. ProcessExecutionException - If an execution problem occurs when starting the process.
  19. Since:
  20. 6.0
Submitted by kaykay on Sun, 08/02/2015 - 19:59

Sean thats what we do too. to assign a task to single user.

what we are trying to achieve is : assign a human task to a group of users and have a bonita do the following - send the task to all the people in the group. and once one of them approves, remove it from the queue of others. And we want to achieve this dynamically via using bonita's api. I am trying to figure out if bonita is even capable of doing it ? or, do we have to write code in our client application ? thanks,

Submitted by Sean McP on Mon, 08/03/2015 - 09:51

Yeah, I know what you mean...

We wrote our own.

What we found was when using actors:

When we assign to a group it gets put into the Generic Tasks bucket, not the users Mytasks. Only these users see it though (which is valid). On taking the process Bonita itself removes the rest.

However, when using the APIs, no, you have to write your own interface.

This is what we do:

  1. Get Group
  2. Get Users in Group
  3. Create Task and Assign to users
  4. Task has a predefined variable that lists all participants
  6. User starts task
  7. On pool page acknowledges responsibility and takes ownership
  8. We delete all other tasks
  9. If for some reason User Cancels doing the Task (yes we have a button for that) then we resend to all participants.

Eventually it gets done :)

When using APIs it gets you to the heart of the matter, but you need to do a lot more work.

We also have a situation where we send the same task to several users and they all have to complete the task, no exceptions, easier to do as there is no task removal :)


Submitted by kaykay on Mon, 08/03/2015 - 14:59

thankyou Sean

Submitted by kaykay on Tue, 08/04/2015 - 15:51


can you explain what you mean by "Task has a predefined variable that lists all participants" ? also, can you explain how to achieve "Create Task and Assign to users" using api. when i assign the task to "multiple users", its technically assigned to the last one in the list.


Submitted by Sean McP on Tue, 08/04/2015 - 18:32

We have a process (pool) Variable (a java list) that keeps the names of the users from the group call it processUsers.

So Group X has users A, B, C, H

The variable stores the names A, B, C, H

then we do this...

  1. For (pUser in processUsers){
  2. startprocess(processed);
  3. get processTaskID;
  4. AssignUserTask(processTaskID, pUser);
  5. }

The task is created multiple times and assigned multiple times, when a user takes the task we delete the others...this is our requirmement.


looking again, you might want to simply do a

  1. startProcess(processID);
  2. updateActorsOfUserTask(processTaskID);

Which will fix the Actors issue.

By TAKING the task the user will then automatically remove it from the other people in the Actor Filter...

might be easier.