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.

Hide UI Action by Role and State

SandyL83
Tera Guru

Hi I need to create a UI action to only display a UI action based on the role of the logged in user and the state of the demand (the UI action is on the Demand table).

 

Here is what I have so far, but it is not working.. any ideas?:

(gs.hasRole('demand_screener') && (current.state == '8' || current.state == '28' || current.state == '-4')) || (gs.hasRole('demand_manager') && (current.state != '8' || current.state != '28' || current.state != '-4'));

 

 

1 ACCEPTED SOLUTION

jMarshal
Mega Sage

have you tried

 

(gs.hasRole('demand_screener') || gs.hasRole('demand_manager')) && (current.state == '8' || current.state == '28' || current.state == '-4')) 

 

??

...also try taking the integers out of quotes...it may be trying to compare as a string to int (evaluating false, as a result).

View solution in original post

2 REPLIES 2

jMarshal
Mega Sage

have you tried

 

(gs.hasRole('demand_screener') || gs.hasRole('demand_manager')) && (current.state == '8' || current.state == '28' || current.state == '-4')) 

 

??

...also try taking the integers out of quotes...it may be trying to compare as a string to int (evaluating false, as a result).

SandyL83
Tera Guru

Thank you!!  the first line of code you provided works perfectly. Thanks again.