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

Sohail Khilji
Kilo Patron

Dear @Purushotham9963 ,

 

'we have many conditions we do not have any space left to give this in the condition field.'

 

There are 2 ways you can over come when you have no space left on condition.

 

1 Easy way :

Create a duplicate ui of the existing UI Action and on the duplicate UI action remove all the condition and place only the condition for which there was no space left.

 

2. Scripted Way: 

Create a script include with all the conditions and call the script include in UI action.

 

Now the choice is yours... 🙂 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

#1 won't work if the logic is all ANDs and not ORs because it's evaluated separately - a simple example, if you have current.state == 3 and gs.isMemberOf(current.assignment_group) and you separate this into two different actions, the UI action will show any time the state is 3 regardless of whether the logged in user is a member of the assignment group. The second action will also show for anyone who is a member of the assignment group, so those people will see two UI actions and not know the difference. 

 

It also means you are duplicating code in more than one place which becomes harder to maintain over time.