In CRM 3 it was possible to hide a button on a toolbar just by calling the document.getElementById(“”).style.display = “none” method.
This will NOT work in CRM 4.0. The ID of the button seems to be generated when the CRM Form is loaded. One time it might be ISV_New_1_MyButtonID the other time it might be ISV_New_39_MyButtonID.
A simple workarround is by checking all the LI items in the UL of the MenuBar and by comparing its ID with “MyButtonID”.
HideButton = function()
var ULListItems = document.getElementById(“mnuBar1”).rows.cells.getElementsByTagName(“UL”).getElementsByTagName(“LI”);
for(var i=0; i<ULListItems.length;i++)
if (ULListItems[i].id.indexOf(“MyButtonID”) > -1)
ULListItems[i].style.display = “none”;
// Execute the function when loading the form
// Execute the function when the form is resized.
window.onresize = HideButton;