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.

How to get users having only ITIL role but not admin role

ajay konduru
Tera Contributor

How do I get users who have only ITIL role but not any other role like admin role?

11 REPLIES 11

Kunal Varkhede
Tera Guru

Hi,

 

Use this in your script

gs.hasRoleExactly('itil');//Returns true only if the current user has the specified role.

 

Thanks,

Kunal

I need to query all the user records through glide record And iterate with this statement right? Is there any better approach

Azim Kazi
Giga Guru

Hi Ajay,

I have figure out the way

we can use filter: sys_id - is - "javascript:getRoledUsers('IN','itil')"

 

 

as I shown below:

 

find_real_file.png

 

 

Hope this will help you!!

If my response helps you then kindly mark my answer helpful 👍and correct ✔otherwise if any query 🤔 feel free to ask further.

 

Thanks,

Ajim

This was a lifesaver!  Thank you!

(FYI, this is on sys_user, not on sys_user_has role)