How to set actor filter with group name and role name ?


I would like to get a user list with specific membership.
I created department bdm and stored department name.

I would like to set Actors with specific group users with a specific role.
variable stored selected groups by a user.

Actor filter has a script as follows :
In this code is username.
However, I would like to send group names in variable.

import org.bonitasoft.engine.api.IdentityAPI;
import org.bonitasoft.engine.identity.User;
IdentityAPI identity = apiAccessor.getIdentityAPI();
User user = identity.getUserByUserName(group);
return user.getId();

Would you help me to get users list with specific group and role ?


Submitted by dkoume_1353153 on Tue, 01/15/2019 - 12:07

import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.identity.UserMembership;
import org.bonitasoft.engine.identity.UserMembershipCriterion;
import org.bonitasoft.engine.identity.UserSearchDescriptor;

List<UserMembership> memberships = apiAccessor.identityAPI.getUserMemberships(userId,0,1,
Long groupId;
if(memberships!=null && memberships.size()>0) {
groupId = memberships[0].getGroupId()

//manager is a example on get role by name change it with your role name
long specificRoleId=apiAccessor.identityAPI.getRoleByName("manager").getId();
final SearchOptionsBuilder builder = new SearchOptionsBuilder(0, 100);
builder.filter(UserSearchDescriptor.GROUP_ID, groupId);
builder.filter(UserSearchDescriptor.ROLE_ID, specificRoleId);

final SearchResult<User> userResults = apiAccessor.identityAPI.searchUsers(builder.done());
List<Long> reviewerList = new ArrayList<Long>();
for(User user:userResults.getResult()){


return reviewerList

I hope this will help ,

best regards

Submitted by donghee.baik on Tue, 01/15/2019 - 16:19

Thanks for your help.
It helps a lot to me.
Then, I realized that I need to change the question.

Is it possible to get a manager's id from groupName?
From group name, is it possible to get a manager's id from each group?

1 answer

This one is the BEST answer!


I think actor and actor filter need a little bit of clarification.

Actor and actor filters are two alternatives to define who can perform a task. Several users might be able to perform one task. In order to avoid concurrent access to execute a task, a user can claim and release a task in the Bonita portal.

Now what is the difference between actor and actor filter:

  • Actor: in the process definition an actor is just a name associate with a lane or directly with a task. In process configuration you will then associate this actor with group(s), role(s), membership(s), user(s) or any combinations of all the previous in order to define who can do the task. Configuration of the actor is only based on organization (users, roles, groups) information. It cannot use process information such as a process business data or information about the user who start the process.
  • Actor filter: first this is really a bad name as it actually does not filter anything. Actor filter is another solution to create a list of users who can do a task. This list of user will be compute by executing an actor filter when the task is reached. An actor filter can have inputs and is executed when the process instance is running. So an actor filter can use information such as process business variable, process instance initiator (the user who start the process)... Actor filter is for example useful if you want to assign a task to the manager of the user who start a process instance. You have a catalog of actor filters available out of the box and you can also create your own one.

In your situation, as you want to associate your task to users only based on roles and groups information, actor option should do the trick.

Let me know if this is not perfectly clear for you.



Submitted by donghee.baik on Tue, 01/15/2019 - 15:30

Thanks for your help. I thought I was not clear about the concept. This is really helpful to me.
I realized that I need to change the question.
For example, I would like to change the question.

Is it possible to get a manager's id from grouplist?
From group name, is it possible to get a manager's id from each group?

import org.bonitasoft.engine.api.IdentityAPI;
import org.bonitasoft.engine.identity.User;
IdentityAPI identity = apiAccessor.getIdentityAPI();
User user = identity.getUserByUserName(groups);
return user.getId();
Submitted by antoine.mottier on Tue, 01/15/2019 - 15:50

For your use case maybe you can configure the actor to get all users with the role "manager".

If it is not what you are looking for maybe can you provide a little bit more details about your use case?

Submitted by donghee.baik on Tue, 01/15/2019 - 19:19

Thanks for the comment.
I would like to explain my situation.

I am modifying a task done by the other person.
In UI form, a user selects groups, put request and upload files, then submit the task.
The selected group returned group names, then, I stored them into groups.
The original code sends the userName by pure JSON.

I would like to store manager's ids and send or set Actor as a manager from selected groups.

I need to get manager's name in UI form or need to get the manager's list in actor groovy script as I write the code.

I hope this works for understanding.

Thanks in advance,

Submitted by antoine.mottier on Wed, 01/16/2019 - 10:12

If I understand correctly in a task a user will select groups of organization managed by Bonita.

After this first task you have a second task that should be performed by one (or maybe performed by all) manager of selected groups.

Is that correct?

Submitted by donghee.baik on Wed, 01/16/2019 - 15:38

Yes. it is correct.
In the first task, a user selects one or many groups. The return value is groupName
The second task should be taken by managers of selected groups.

Thanks for your help.

Submitted by donghee.baik on Wed, 01/16/2019 - 20:43

I can solve this using by database connector and retrieve the group name and manager name in the task,
However, I would like to solve the issue with actor filter configuration.

In Actor filter of the second task, set the users with a groovy script as managers of groups.

Is it the right way to approach the issue?
Thanks a lot.

Submitted by antoine.mottier on Mon, 02/11/2019 - 17:23

I create an example of custom connector that I think do what you are looking for. An example of process is available as well. You can get it from GitHub:

Submitted by donghee.baik on Thu, 04/11/2019 - 19:40

Thanks for providing the example.
However, I could not download the latest release bos file from the github.
Would you update the final version of the release, please?

Thanks in advance.

Submitted by antoine.mottier on Tue, 04/16/2019 - 08:39

On GitHub if you switched to the "release" tab (between "branch" and "contributors" right above the list of files and the buttons such as "clone or download") you get the following page:

On this release page, if you select one specific release (such as 0.0.1) you get a page dedicated to this specific version. E.g.

On a specific release page you always have two files (zip and tar.gz) that includes source code. Optionally you have additional files.

For my example on you can find a file named project_20190211_1624.bos that can be downloaded and import in the Studio.

Here is a direct link to download the file: