- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2017 07:47 AM
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'?
Thanks in advance for your help!
Solved! Go to Solution.
- Labels:
-
Best Practices

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2017 07:55 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2017 07:55 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2017 08:01 AM
Try the later condition i.e. NOT IN provided.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2018 07:25 AM
Hi,
I know this is an old thread but here's an alternative that seems to work . . .
gs.hasRole("change_coordinator") && (current.state != ('14'||'12'||'3')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2019 06:10 AM
> (current.state != ('14'||'12'||'3')
Doesn't do what you think. ('14'||'12'||'3') is evaluated to '14', then is compared to current.state. It would only work for '14', not '12', nor '3'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2019 06:04 AM
This pattern scales well to long lists, especially useful if you have limited space in your Condition:
['14', '12', '3'].indexOf(current.state.toString()) == -1
Alternatively, the 'is one of' pattern:
['14', '12', '3'].indexOf(current.state.toString()) > -1