Showing posts from 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) { navitem.setVisible(false); }
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 Jav…

Referencing Multiple Javascript Libraries in Homepage Ribbon Buttons

When we develop JavaScript functions for the Actions and CustomRules of the Ribbon buttons in CRM 2011, we may need to reference the common JavaScript library or other javascript libraries. For the ribbon buttons on the form, we can simply add those additional libraries in the Form Libraries and call the functions in those libraries but for Homepage ribbon buttons, we need to try a different approach to achieve it.

<Actions> <JavaScriptFunction Library="$webresource:new_MainEntityLibrary" FunctionName="Test" /> <JavaScriptFunction Library="$webresource:new_CommonLibrary" FunctionName="isNaN" /> //This is the additional library </Actions>
The FunctionName of the JavaScriptFunction action tag is required so that putting isNaN as a value will do the trick instead of calling the dummy function with no action.
This method can also be used for Sub-grid ribbon buttons if the sub-grid is displayed is multiple forms …