How can i fetch user list having a specific role.

Hemant13
Kilo Contributor

My requirement:

I have created a role, provisioning_approval.

I have created few users and among them i have assigned this role to 3 of them.

I have a form and there i want to list the approval names(select box).

So do we have a way through client script i can directly fetch users having that role assigned to them.

I tried an onLoad script but not sure how to fetch correct list bcz below is giving me current user name.

if(g_user.hasRole('provisioning_approval')) {
    g_form.addOption('app',g_user.getFullName(), g_user.getFullName());
}

 

  1. Do we have any way to fetch User list based on role
  2. Should i go through each user in loop and check their role and add in the drop down list.

 

 

Please help and let me know if any other details are required.

1 ACCEPTED SOLUTION

RaghavSh
Kilo Patron

If you want all the users with your specific role no need to write script, you can create a lookup select box instead of select box with following conditions:

find_real_file.png

replace the sys_id of your role, in reference qualifier.


Raghav
MVP 2023

View solution in original post

13 REPLIES 13

@Namrata I created 2 users and to both of them i have given the privilege(role). And when I logged in as system admin it shows both of their name in drop down list.

But once I logged in as one of the user the drop down showed nothing.

 

Hi Hemant

check the read ACL's for the sys_user_has_role table.

Extend it with the role the required users have.

 

Hemant13
Kilo Contributor

@Gábor Could you please explain in brief, I am new to service now.

I went to sys_user_has_role and enabled the following check box.

how exactly I can extend it to the role that i have specified ? 

 

find_real_file.png

Go to read ACL of("sys_user_has_role") table and add "snc_internal" role to the list of roles:

find_real_file.png

Do elevate your privileges before changing ACL( you need security adim role for same)


Raghav
MVP 2023

@hemant were you able to mdify acl and make this working

Raghav
MVP 2023