Offer a task to a role but exclude some users

Hello,
is it possible to offer a task to a role but exclude individual users who have performed previous tasks?
For example: Task 1 is offered to all accountants and completed by accountant1. Task 2 should now be offered to all accountants except accountant1.

Many thanks in advance.

Hello Dreiss,

It is possible to implement your use case indeed. 

You need to setup an actor filter on your task that filters out the users who have the role but have already executed the previous task. 

Here are documentation pointers: https://documentation.bonitasoft.com/bonita/latest/process/actor-filtering

If you cannot find what you need by default you can create a customer Actor Filter and share it with the community so that the next person with the same need can leverage your contribution. Let us know if you need more help (including if you need help to implement a custom actor filter)

Hope this helps

Captain Bonita 

Hi, 
thanks for the answer. Since there is no standard Actor Filter that offers this functionality, I would have to program my own.

Could you perhaps provide an example of a custom Actor Filter that implements this behavior?

Hi,

The easiest way I can explain that is probably by inviting you to fork the open-source SameTaskUserActorFilter 

In that implementation we only return the userID of the user who executed a given Task.

final long executorId = archivedTask.getExecutedBy();

In your case, you want to keep all the users of the Actor except from the user who executed the task.

So you can look at the CustomUserInfoUserFilter. On line 67 it builds the list of people in the actor to filter 

List<Long> userIdsForActor = getAllUserIdsForActor(actorName, processAPI);

From there you can remove from the list userIdsForActor the user who executed the first task, i.e.executorId . 

Then you return an unmodifiable as a result:

return Collections.unmodifiableList(userIdsForActor);

 

Of course, you will have to name and id your filter differently than the one you forked to avoid conflicts.

I hope this helps,

Captain Bonita