Monday, April 11, 2011

Disable ISV Button on Dynamics CRM Toolbar

ISV buttons are used to extend certain functionality on Dynamics CRM Tool bars. The id of an ISV button will be different each time the page is refreshed. So its a bit tricky to identify the ISV button and attach functionality or hide or disable it.

The following method will disable the ISV button on the CRM tool bar in an iFrame. This method could be extended to access ISV buttons on the tool bar.


// ----------------------------------------------------------
// DisableIsvButton
// Disable Isv Button on an iFrame
function DisableIsvButton(iframeID, searchText) {

var frame = document.getElementById(iframeID);

var menuItems = frame.contentWindow.document.getElementsByTagName("li");

for (var i = 0; i < menuItems.length; i++) {

if (menuItems[i].id.indexOf("ISV") == 0 && menuItems[i].id.indexOf(searchText) > 0) { menuItems[i].disabled = true; break; }

}
}

Hope this helps you...

Abish

No comments: