Friday, June 25, 2010

Hide CRM form Button/menu/sort cuts/isv buttons in MS CRM 4.0

function HideISVButtons()
{

var toolBar = document.getElementById('mnuBar1');
if (toolBar != null && toolBar.rows.length > 0 && toolBar.rows[0].cells.length > 0)
{
try
{

var toolBarItems = toolBar.rows[0].cells[0].getElementsByTagName('li')
if (toolBarItems != null && toolBarItems.length > 0) {
for (var i = 0; i < toolBarItems.length; i++) {
var toolBarbuttonName = toolBarItems[i].getAttribute('title');
switch (toolBarbuttonName) {
case "Attach a File":
toolBarItems[i].style.display = 'none';
toolBarItems[i - 1].style.display = 'none';
break;
case "Print Preview":
toolBarItems[i].style.display = 'none';
break;
case "Actions":
toolBarItems[i].style.display = 'none';
toolBarItems[i - 1].style.display = 'none';
break;
break;
case "Follow Up":
toolBarItems[i].style.display = 'none';
toolBarItems[i - 1].style.display = 'none';
break;
case "Test ISV Button":
toolBarItems[i].style.display = 'none';
toolBarItems[i - 1].style.display = 'none';
toolBarItems[i + 1].style.display = 'none'; break;
}
}
}
}
catch (e)
{ }
}
}

No comments: