How to hide an UI Action from List Context menu based on condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2016 04:20 AM
Hi,
I have created a custom UI Action (Form button + List context menu). In this UI Action, I've provided a condition to hide/show the UI Action.
The UI Action is hidden when the condition is not satisfied on the "Form". But in the List context menu, the UI Action is still show.
When I do the action, I get the message "Security does not allow the execution of that action against that record".
Instead of showing the UI Action and displaying a message, is it possible to hide the UI Action when the condition is not satisfied?
The condition in the condition field is something like "current.field_name == 'value'".
More details about the UI Action:
Show insert - yes
Show update - yes
Client - no
Any clues? Thanks in advance for your help.
- 3,358 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2016 04:31 AM
There is a list context menu checkbox which needs to be unchecked.
Thanks and Hope it helps.
Akhil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2016 05:06 AM
Akhil,
Thanks for your response.
Maybe you have read my question only partially.
I don't want to hide the UI Action from list context menu (always).
I want to hide the UI Action from list context menu "based on condition". And the problem here is that the UI Action is always shown on the list context menu, and when the user clicks it and the condition fails, it displays an error message that the action is not allowed.
So, instead of showing an error message when the condition fails, I would want SN to not display the UI Action in the first place.
Regards,
Bala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2016 01:53 AM
Hi Bala,
This should be pretty straight forward if it's a simple UI Action.
What you need to do is find the UI Action in question and simply update the Condition field. The example below will only show the UI Action if the record is an existing record rather than a new one and the user has the 'Project Manager' role:
!current.isNewRecord() && gs.hasRole('project_manager')
Looking at your message it seems that this is something that you are aware of. What condition are you using or trying to use?
Thanks,
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2016 01:05 PM
Hi Peter,
Thanks for your response.
The condition which I use is "current.field_name == 'value'".
This condition works perfectly fine for "Form button" UI Action. i.e. the button is not shown on the form when the condition fails.
In the same UI Action, I've also selected "UI Context menu" and I would expect the condition to work perfectly for the UI Context menu too, but it doesn't.
What happens is that the UI Action name is ALWAYS shown in the UI Context menu. When I right click the record in the list and click on the UI Action and if the condition fails, I get an alert message "Operation not allowed."
What I would want instead is "Not show the UI Action in the list context menu" in the first place if the condition fails.
Hope I explained clearly.
Regards,
Bala