Friday, May 18, 2012

MS CRM 4.0 Rename or Remove Left Nav Bar Menu Items.

Posted in [Dynamics CRM], [Technical] By Michael Thompson @ 2/2/2009 4:51 PM

 

 

 In MS CRM 4.0 have you ever wanted to rename or remove Left Nav links on an entity only to find the OnLoad script fails when trying to use the preview function on the form designer? 

In many CRM installs companies prefer to not use the Microsoft CRM product catalog so that Write-In Products is really the list of products (on a Quote for example) and Existing Products never has anything listed under it.  Thus they would prefer to eliminate the Existing Products link in the left nav area, and rename "Write In Products" to "Products" or possibly "Line Items."

The scripts below rename the Write-In Products link and remove the Existing Products link.  They also check to see if the link exists before going through the function, thus preserving the preview functionality of the form designer (if you preview a form without running this check, then the preview will throw and error).  This rename also avoids going to the server to pull icons as many other scripts do.  Note in the rename function a line is repeated twice.  No it is not a mistake, it is needed.  The rename function passes in 3 parameters (navName, Display text, name you want displayed).  You will probably need something like IE Dev toolbar to be able to find the navName.

 

 

/* Retext/Rename Left Nav Display links. */

function leftNavRename(leftNav, oldName, newName)

{

    var navItem = document.getElementById(leftNav);

    if(navItem  != null)

    {

        navItem.innerHTML = navItem.innerHTML.replace(oldName, newName);

        navItem.innerHTML = navItem.innerHTML.replace(oldName, newName);

    }

}

leftNavRename ('navWriteInProducts','Write-In Products','Products');

 

 

/* Remove Left Nav bar links */

function leftNavRemove(lNav)

{

    var lNavItem = document.getElementById(lNav);

    if (lNavItem != null)

    {

        lNavItem.parentNode.style.display ='none';

    }

}

leftNavRemove('navExistingProducts');

Comments

Got something to say? Join the discussion »

leave a reply

 [Quick Submit with Ctrl+Enter]

Remember my details
Notify me of followup comments via e-mail

C5_Insight

About C5 Insight

We are a Microsoft Gold Certified partner focusing on SharePoint, Microsoft Dynamics CRM and Salesforce.com.  Learn more about us by visiting our website.

Search

We Wrote the Bible on Microsoft SharePoint and Dynamics CRMBook-Microsoft Dynamics CRM 2011 and SharePoint 2010 Bible

Tags

Maximize

Recent Comments

Maximize

Blog Roll

Maximize

Disclaimer

The information herein may be used solely at your own risk.  No warranty is made by the author or by C5 Insight, Inc.

The opinons expressed herein are those of the individual authors and do not necessarily represent C5 Insight, Inc in any way.

Copyright 2011 by C5 Insight