Hide UI Action

DreDay3000
Giga Guru

Hello, I have created a UI Action that should only show for certain users. I have added a condition shown below. However if I impersonate a user who cannot create a record on the table, the button still shows. Is there a way to hide this button? it is the only button showing on the form

1 ACCEPTED SOLUTION

Hi @DreDay3000,

 

@Vishal Jaswal was absolutely on the money re leveraging parenthesis. Another condition you may want to consider based on your feedback is "&& current.canCreate()".

This essentially checks if the user has access to create a record in the related table (or passes can create ACL).

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie

View solution in original post

5 REPLIES 5

Vishal Jaswal
Giga Sage

Hello @DreDay3000 

Have all OR conditions in the paranthesis as they will be evaluated first and then && condition.

(gs.hasRole("abc_template_read") || gs.hasRole("abc_template_create") || gs.hasRole("abc_template_admin")) && current.u_state != "review"



 


Hope that helps!

Thanks, the user I'm testing with has read and write permissions to that form but does not have create and the button still shows for that user. I have tried the condition you recommended.

 

DreDay3000_0-1743019491361.png

 

Either of two below should work for you:

(!gs.hasRole("abc_template_read") && (gs.hasRole("abc_template_create") || gs.hasRole("abc_template_admin"))) && current.u_state != "review" 


(gs.hasRole("abc_template_create") || gs.hasRole("abc_template_admin")) && current.u_state != "review"
 


Hope that helps!

Hi @DreDay3000,

 

@Vishal Jaswal was absolutely on the money re leveraging parenthesis. Another condition you may want to consider based on your feedback is "&& current.canCreate()".

This essentially checks if the user has access to create a record in the related table (or passes can create ACL).

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie