- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2025 09:51 AM
Hello everyone! Just wanted to ask a quick question that I hope is pretty simple, I think my syntax is just a little off. Relatively new to developing in ServiceNow and in the process of creating a UI Action with some conditions for a button to show up. I think I'm missing something small here but can't seem to get it to show. The condition for the button to show is that:
1. It needs to be in status 123, or status ABC, or status XYZ
AND
2. The user has to have either role 1 or role 2
I can't seem to get the syntax correct to show for these conditions in the UI Action, hopefully someone can help. Thank you for the time
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2025 10:30 AM
Hello @ndejoya ,
For the roles you can add in the condition field: gs.hasRole('role 1, role 2') or you can simply add in the requires role tab.
For the Status you can added in condition like: current.getValue('status') == '123' || current.getValue('status') == 'ABC' || current.getValue('status') == 'XYZ'
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2025 10:20 AM
It will depend on the actual field name for status for whatever form you are using, but here's something to get you started:
(current.status== '123' || current.status == 'ABC' || current.status == 'XYZ') && (gs.hasRole('role1') || gs.hasRole('role2'))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2025 10:30 AM
Hello @ndejoya ,
For the roles you can add in the condition field: gs.hasRole('role 1, role 2') or you can simply add in the requires role tab.
For the Status you can added in condition like: current.getValue('status') == '123' || current.getValue('status') == 'ABC' || current.getValue('status') == 'XYZ'
Thank you.