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.

user criteria advanced script to add condition if a user doesnt have a role

alipia123
Tera Contributor

Hi i am trying to write a user criteria that contains users that dont have a specific role by using the advanced script  Would anyone be able to help me with the script that I should use?  I have tried several variations and still struggling to get it to work 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

You should be able to use something as simple as this:

answer = !gs.hasRole('admin');

View solution in original post

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

You should be able to use something as simple as this:

answer = !gs.hasRole('admin');

alipia123
Tera Contributor

Thankyou! that is working 🙂

Great to hear, and you are welcome!