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

I don't need my button to appear , it's just for hiding the 'Delete' button of[sys_ui_action]

I have few questions now. What confuses me is you have not selected where to avail 'Delete' UI action to non-admin users (ex. on form, list context menu, list choice etc). In this case this UI action will not e available to any one be it admin or non-admin.

 

As per your query "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? "   , this to me means that you have created a delete ui action and you want your created UI to be visible/active to non-admin users and inactive to admin user.

 

Now if you want to make it inactive to admin users then please change the condition to " !gs.hasRole('admin')  "

 

This will make UI action invisible to admin and visible to rest all users.

 

 

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

In that case you just need to create a Delete UI Action on sys_ui_action table, please follow below steps and you should be able to achieve your requirement.

 

1. Find the Global Delete UI Action for Form Button and the hit Insert and Stay

find_real_file.png

 

2. Change the table name to sys_ui_action

find_real_file.png

3. update the condition with: gs.hasRole('admin')

Please check the suggestion which i provided and also you need to select the UI Action which you want to display or hide.

Aaron Munoz
Tera Guru

Hello Chenyanwei,

To make a ui action inactive to admin, active to other roles you can add the following in the condition

(gs.hasRole('admin') == 'false')

Also consider that the global Delete button uses "current.canDelete()" as a condition, so to hide it make sure the current user doesn't have deletion rights (look at the ACLs of the table).

Regards