Hiding Context Menus at Runtime in the SalesLogix web client using modules

Ryan, wrote a great article on how to use a module to hide a toolbar item at runtime here.  I wanted to expand his article slightly to show how a similar technique could be used to hide a context menu.

The main difference is what workspace the context menu exists in.  In Ryan’s example he uses the ToolbarWorkspace, where the Context menus reside in the NavWorkspace.

Lets look at the code needed to hide the Insert Account/Contact context menu from the Account context menu group:

NavWorkspace navbar = _parentWorkItem.Workspaces["NavBar"] as NavWorkspace;
if (navbar == null) return;
 
IMenuService navmenusvc = toolbar.WorkItem.Services.Get<IMenuService>();
if (navmenusvc == null) return;
 
NavItemCollection navcol2 = (NavItemCollection)menusvc.FindMenu("contextAccount") as NavItemCollection; 
if (navcol2 != null)
{
    navcol2.RemoveItem("menuItemNewContactAccount");
}
ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

1 Comment

  1. Andrew you are using FindMenu? I don’t have access right now to check but I am pretty sure that is not the right method to find a button?

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!