Context Menu UI Actions that use a script includes in the 'Condition' will not get evaluated after the first time until we clear instance cache by performing /cache.do
All the context menu UI Actions get evaluated for the first time when the user logs in. Then the condition evaluation is stored in the expression cache. The next time during the same session (if the logged-in user do not have permissions to see the UI Action), simply refreshing the form/list will not affect the changes until administrators clear instance cache.
The reason is the system automatically stores the UI Action conditions in expression cache (instance cache) and doesn't re-evaluate every time the user refreshes the form/list.
In order to prevent the Context Menu UI Actions from being cached, we can make use of the following:
- Open the Context Menu (sys_ui_context_menu) record for which you want the conditions to be evaluated every time the user refreshes the page.
- On the 'sys_ui_context_menu' record, click on Configure > Form Layout" and add the "Do not cache" field to the view, and check it
- Save the changes.
You should not be seeing this condition expression stored in the cache anymore. This will get evaluated always whenever the user refreshes the page.