how can we get organization roles and groups to be filled in dropdown list in UI designer

I am a beginner in Bonita and working on a project . My requirement is to get groups and roles to be filled from organization structure to drop-down list in UI form how can I achieve this ? do I need a connector? please give a sample.

 

 

 

Hello,

You have to use a REST API to collect all the users / Groups / Roles.

Have a look at these REST API

https://documentation.bonitasoft.com/bonita/7.11/identity-api

Best,

Hi Pierre

Thanks for the replay 

I have checked with Identity API .

  • I have created variable  getGroups with External API  having API URL:  /API/identity/group and similarly for roles variable as getRoles with External API  having API URL:  /API/identity/role
  • for roles and groups dropdown list  in Available values i clicked on (fx) and added getGroups and getRoles  and value configBdgtWiseApprover.approverRole,configBdgtWiseApprover.approverGroup as per my BDM and contract 
  • I have taken 2 texts and in-text I have added {{getGroups | json}} and {{getRoles | json}} respectively but nothing is displayed and dropdown list are also not filling with organization groups and roles.

Is this the way of calling the Identity API or am I missing anything please guide?

Also tried with below code in operations as a next trial for getting list of groups  but iam getting error .Please suggest is this the correct way wrong  .I have got it from below URL

https://documentation.bonitasoft.com/bonita/7.10/manage-an-organization

import javax.naming.directory.SearchResult
import org.bonitasoft.engine.api.IdentityAPI
import org.bonitasoft.engine.api.TenantAPIAccessor
import org.bonitasoft.engine.identity.Group
import org.bonitasoft.engine.search.SearchOptionsBuilder
import org.bonitasoft.engine.session.APISession
import groovy.test.GroovyAssert
 
final IdentityAPI identityAPI=TenantAPIAccessor.getIdentityAPI(APISession);
final SearchOptionsBuilder builder=new SearchOptionsBuilder(0, 100);
final SearchResult groupResults =identityAPI().searchGroups(builder.done());
return groupResults;

 

 

 

Hello,

Open the browser debugger (F12) and goes to the panel "Network". Then, access your page. If the getRoles is empty, that's means the REST API Failed, and you should see in the panel Network what's happen.

I have the feeling your REST API is not correct : the correct one is something like 

../API/identity/group?p=0&c=100

==> Did you place .. before /API? Did you set p=0&c=100 ?

 

For the JAVA, it's correct.

So you you return a SearchResult information. If you want to use that in a REST API Extension, you have to change that in a structure to return it as a JSON, then use a JSON Builder to generate the JSON to return it to your browser.