Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Find User with only the specified roles

david_hreben
Giga Expert

I need to find the users in my system that only has the 2 roles am interested in and nothing else. The report system only lets you find either one role or the other role but I would like to know how to get users with 2 roles that I need (Ex: Admin,itil...and no other roles). Thanks in advance!

8 REPLIES 8

Michael Fry1
Kilo Patron

Run a report on the User Role [sys_user_has_role) table adding your 2 roles to the criteria.


I did but those user have also other roles which am not interested. I just need to find the user with the roles I specified and nothing else.


Try this:


2.jpg



add your two roles and it should show you the users with those 2 roles.


I had my hopes it would but it did not. just need the users with it_ess & it_requestor...if it has anything else it does not work. let me show you the result your conditions gave me (name, role):



X Guytemplate_editor
X Guyit_ess
X Guyit_requestor
X Guyitil
X Guyreport_group
X Guyit_ess
X Guyit_requestor
X Guyitil
X Guytemplate_editor
X Guyreport_group
X Guysurvey_reader
X Guyit_ess
X Guyit_ess
X Guytemplate_editor
X Guyreport_group
X Guyreport_group
X Guyit_requestor
X Guyitil
X Guyit_requestor
X Guytemplate_editor
X Guyitil
X Guyrm_task_admin
X Guyscrum_user
X Guyrm_product_admin
X Guytask_editor
X Guyrm_epic_admin
X Guyrm_doc_admin
X Guyrm_story_admin
X Guyrm_sprint_admin
X Guyscrum_admin
X Guyproject_user
X Guytask_editor
X Guyrm_test_admin
X Guytask_editor
X Guyproject_manager
X Guyproject_portfolio_user
X Guyrm_release_scrum_admin
X Guyit_ess


get the idea?