Friday, 8 June 2012

Hiding Left Navigation Menu Items in an Entity Form using Javascript in MS CRM 2011

In the form designer, you can remove the items from the left navigation. If you remove all the items in the navigation area, the group header will be hidden as well except for some navigation areas like Common, Marketing and Processes.

But if you're looking for a solution to hide the navigation items based on the condition, values, etc. you can use the following JavaScript to hide them.

 var navitem = Xrm.Page.ui.navigation.items.get("nav_new_test_new_testchild") // for e.g "navContacts";    
 if (navitem != null)  

Normally, the name of the navigation is

  • "nav" + Entityname in plural for the system entities or
  • "nav_" + relationship name between these 2 entities

but there are some exception cases for the system entities like "navOpps" so that if it's not working just by guessing, you can use IE Developer Toolbar to find the name of the navigation item.

Hiding the navigation items with Java Script will still leave the header of the navigation area though.

No comments:

Post a Comment