assign human task multiple users

1
0
-1

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

1
0
-1
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:

http://documentation.bonitasoft.com/creating-actor-filter-0

regards

Comments

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 ?

Thanks,

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...

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

We also use this:

startProcess()
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:

http://documentation.bonitasoft.com/javadoc/api/7.0

startProcess
ProcessInstance startProcess(long userId,
                           long processDefinitionId)
                             throws UserNotFoundException,
                                    ProcessDefinitionNotFoundException,
                                    ProcessActivationException,
                                    ProcessExecutionException
Start an instance of the process with the specified process definition id on behalf of a given user.
Parameters:
userId - The user id of the user.
processDefinitionId - The identifier of the process definition for which an instance will be started.
Returns:
An instance of the process.
Throws:
UserNotFoundException - If the given user does not exist.
ProcessDefinitionNotFoundException - If no matching process definition is found.
ProcessActivationException - If a problem occurs when starting the process.
ProcessExecutionException - If an execution problem occurs when starting the process.
Since:
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:

Get Group
Get Users in Group
Create Task and Assign to users
Task has a predefined variable that lists all participants

User starts task
On pool page acknowledges responsibility and takes ownership
We delete all other tasks
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 :)

regards

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

thankyou Sean

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

Sean,

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.

Thanks

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...

For (pUser in processUsers){
startprocess(processed);
get processTaskID;
AssignUserTask(processTaskID, pUser);
}

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

However,

looking again, you might want to simply do a

startProcess(processID);
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.

regards

Notifications