how to make the ui action be inactive except to admin?

chenyanwei
Giga Contributor

I create a ui action and the action name is delete_checked to hide the 'Delete' ui action of table[sys_ui_action] in my table .but how to make my ui action inactive  to admin, active to other roles? 

10 REPLIES 10

Shishir Srivast
Mega Sage

You can add below in condition to have the UI Action enable only for admins,

 

gs.hasRole('admin') 

kumarkamlesh
Mega Contributor

Hello Chenyanwei,

 

You can use condition of the ui action and specify the condition "gs.getUser().hasRole('admin')".

 

find_real_file.png

 

When you do this it means that show this UI action only if the user has admin role else hide this.

 

Please mark this helpful if this rings the bell and mark it correct if this solves your issue.

 

Regards,

Kamlesh

 

 

I tried and it didn't work as I supposed either:
find_real_file.png

Hi Chenyanwei,

The issue I can see from your screen shot is, you have not checked "Form Button" that's why it is always hiding.

 

find_real_file.png

 

Please check the check box as per your requirement and then test.

 

Please mark this helpful if this rings the bell and mark it correct if this resolves your issue.