We generally disable or make the control directly invisible in any form using some standard methods like form datasource active() or may be init() or using some methods in interactive classes if using a list page. But let's say we have a requirement to make a menuitem invisible based on certain condition. Then how to achieve it? Here we do not have any form method, right?
So, let's not wait more and check how this can be done.
To achieve the above requirement, we need to subscribe to a standard delegate called checkAddSubMenuDelegate of Class SysMenuNavigationObjectFactory,
Use case here is if the Menu Item should be invisible in some specific legal entity or may be in other condition, we can follow this.
Below is the approach for the same. The condition returns a boolean value which specifies if the menuitem should be visible or invisible.
In this way we can achieve this.
Happy Learning :)