
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 12:23 PM
I am trying to get a list of all roles a single user is assigned, however, this query doesn't appear to work
https://<instance>/api/now/table/sys_user_has_role?sysparam_query=user.value=<sys_id>
...It returns the entire table
Thoughts?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 12:32 PM
Can you try with below url
https://<instance ID>.service-now.com/api/now/table/sys_user_has_role?sysparm_query=user%3Dd3dbbf173b331300ad3cc9bb34efc466&sysparm_display_value=true&sysparm_exclude_reference_link=true&sysparm_fields=role

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 12:32 PM
Can you try with below url
https://<instance ID>.service-now.com/api/now/table/sys_user_has_role?sysparm_query=user%3Dd3dbbf173b331300ad3cc9bb34efc466&sysparm_display_value=true&sysparm_exclude_reference_link=true&sysparm_fields=role

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 12:35 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 02:26 PM
Thanks - I tested this on a single user sys_id, and it returned 10,000 results, however, the user sys_id only had 68 roles assigned to it. So it seems as though the query is not working as expected.
Thoughts?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 02:40 PM
Hi, you've declared "user.value" which would be an invalid query so the entire table will be returned. Your query should be
https://<instance>/api/now/table/sys_user_has_role?sysparam_query=user=<sys_id>
Alternatively you can use the /global/user_role_inheritance if you want to see more of a inheritance map view.