UI Action Condition: 'is one of' or 'is not one of' possible?

andy_dufresne
Tera Expert

HI All,

I have a cancel button that I want to show only when a user has role 'Change_coordinator' and the state of change is not one of 14, 12, or 3

So My UI condition is:

gs.hasRole("change_coordinator") &&   current.state NOT IN '14','12','3')

ServiceNow doesnt like it, it reports the following error:

Do you know how I can get condition to show: 'is one of' or 'is not one of'?

find_real_file.png

Thanks in advance for your help!

1 ACCEPTED SOLUTION

Tanaji Patil
Tera Guru

Hi, This is not possible but you can do same (IN) with "gs.hasRole('change_coordinator' && (current.state == '14' || current.state == '12' || current.state == '3')". And NOT IN with "gs.hasRole('change_coordinator' && current.state == '14' && current.state == '12' && current.state == '3'".


Thanks, Tanaji Patil


View solution in original post

9 REPLIES 9

BALAJI40
Mega Sage

You need to apply the condition like,



  1. gs.hasRole("change_coordinator") &&   (current.state!='14' || current.state!='12' || current.state!='3' )

Thanks Balaji,



So I thought, but that did not work.   when the state is actually '3' the cancel button still shows up.  


You have to && states and not ||.


yes provide && operator,


  1. gs.hasRole("change_coordinator") && (current.state!='14'&&current.state!='12'&&current.state!='3')