
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 05:27 AM
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());
}
- Do we have any way to fetch User list based on role
- 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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 05:42 AM
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:
replace the sys_id of your role, in reference qualifier.
Raghav
MVP 2023

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 11:28 PM
Hi @Raghav
I did try this,
- If I assign "itil" role to any of my newly created user then it works fine but this role comes with many other inherit list.
- If i assign my created role to any of servicenow existing user then also it works fine.(because that user already has "itil" role.
So could you please let me know if there is any specific role I have to assign my new user to make it work from the "itil" list.
Also can I have that role as part of the role which I have created so I(admin) don't have to assign multiple roles to any such user.(if it auto inherits or something without much manual intervention).
Or if there is any alternative available to "itil" role.
What are the significance of assigning a user "itil" role.
Also, I didn't find any role naming as "snc_internal"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 11:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2020 11:50 PM
Hi,
If you only need access to read the data from approvals table, grant the "approver_user" role to the users, and it should be able to fetch you the list from the approvals table.
Thanks & Regards,
Rishabh Jha
Aavenir (http://www.aavenir.com/)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2020 06:51 AM
Thanks everyone for your responses.
This is what I followed which worked for me:
- Created a lookup select box as suggested above.
- Imported itil to the role provisioning_approval that I have created.
- Assigned the role to the user I have created.
- User got both the roles and it worked fine.