Hiding Menu Items from top menu bar in CRM 4.0

Here is a little script which you can call to hide menu item from top menu.
Put this script on page load or on any other event where you would like it.
You might also wanna add it as document.HideMenuItem = new function(targetMenu, targetMenuItem) {//code goes here};

function HideMenuItem(targetMenu, targetMenuItem) {
var menuLIs = document.getElementById(“mnuBar1″).getElementsByTagName(“LI”);
for (var i = 0; i < menuLIs.length; i++) {
if (menuLIs[i].title && menuLIs[i].title.indexOf(targetMenu) > -1) {
var targetDivs = menuLIs[i].getElementsByTagName(“DIV”);
for (var j = 0; j < targetDivs.length; j++) {
var targetLIs = targetDivs[j].getElementsByTagName(“LI”);
for (var k = 0; k < targetLIs.length; k++) {
if (targetLIs[k].innerHTML.indexOf(targetMenuItem) > -1) {
targetLIs[k].style.display = “none”;
return;
}
}
}
}
}
}

All you have to do is call it with two parameters first parameter is the text without space so if you have root menu named Sub Test, you should call it SubTest. And the second parameter is the whole text of the menu item you need to hide.

HideMenuItem(“ISV.NEW”, “Coming Soon…”);
HideMenuItem(“SubTest“, “Test Sub 1”);
HideMenuItem(“ISV.NEW”, “Web Only”);

Let me know if you need any more info on the same.
PS: Thanks to Andrew, there was a bug in the previous version of script, which didn’t work with all the menus but now it has been fixed.

Leave a Reply

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