Hi @BM-31070523-0 ,
Yes use SysDictMenu.isVisible() to retrieve the Visible property at runtime:
SysDictMenu sysDictMenu = SysDictMenu::newMenuName(menuItemDisplayStr(YourMenuItemName)); boolean isVisible = sysDictMenu.isVisible();
This is confirmed directly from the standard framework class SysMenuNavigationObjectFactory, which uses this same call to decide whether to render a menu item.
Note: this only reads the static, design-time property there's no setter via X++. If you need to dynamically control visibility at runtime (hide/show based on a condition), use this supported pattern instead:
[SubscribesTo(classStr(SysMenuNavigationObjectFactory), staticDelegateStr(SysMenuNavigationObjectFactory, checkAddSubMenuDelegate))]
public static void menuItemVisibilityHandler(SysDictMenu _rootMenu, SysDictMenu _subMenu, SysBoxedBoolean _subMenuVisibility)
{
if (_subMenu.isMenuItem())
{
var metaElement = _subMenu.GetMenuItemMetaElement();
if (metaElement != null && metaElement.Name == menuItemDisplayStr(YourMenuItemName))
{ _subMenuVisibility.value = false; // or your condition }
}
}
This doesn't change the stored AOT property, but it excludes the item from the navigation tree at runtime based on your logic the effective equivalent of dynamic visibility control.
Thanks, If this answer you question mark this as verified