Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to show UI action to only few Roles

Purushotham9963
Tera Contributor

Hi ,

i have created one UI Action on incident Table to created child tasks. and the Button ' create task' should be visible to only for few users who is having few custom roles.

And i am aware that we can achieve this if we give"gs.hasRole('contract_manager')  " in the condition field in UI action. But since we have many conditions we do not have any space left to give this in the condition field.

Can anyone please help me with the script to achieve this?

6 REPLIES 6

Martin Grosskop
Tera Guru

There is tab on a UI action where you can list the roles required to see the UI action:

 

MartinGrosskop_0-1673955879049.png

 

Purushotham9963
Tera Contributor

I tried that unfortunately it is not working

Hello,

Did you ever get an answer to this.   It is not working for me.

Thanks.

Chad

Hi all,

Requires Roles works (I just confirmed it), however it does work in the same way ACLs do - a user can have any of the roles listed, they do not need to have all the roles listed. Here is my configuration and it works as expected, the UI Action does not appear for users who do not have the role listed

Rebecca3_0-1723721639302.png

 

I have encountered issues with the character limitation on the Conditions field and a way around this is to move the logic to a script include and call the script include in the condition check - ServiceNow even does this, an example is the 'Assign to me' out-of-box UI action installed with ITSM Workspace (sys id = e44b67f63b330300a2bac9bb34efc46a)

Rebecca3_1-1723721903093.pngRebecca3_2-1723721951345.png

 

Rebecca