I had this requirement to remove ribbon items (button, group) using Javascript.
Standard and supported way is by editing Ribbon XML located in Entity XML.
But sometimes need arises to do this using Javascript (unsupported way):

here is the code to do it. I used this on form onload.

//Javascript Code:
function HideARibbonItem(nameOfItem) {
var intervalId = window.setInterval(function ()
{
if (window.top.document.getElementById(nameOfItem) != null)
{
window.clearInterval(intervalId);
var elem = window.top.document.getElementById(nameOfItem);
//top menu has loaded
//Hide the item
elem.style.visibility = ‘hidden’;
//Remove the item
(elem.parentNode).removeChild(elem);
}
}, 100);
}
// Code finishes here
nameOfItem is : id field of ribbon item, group or button. This need to be passed to function through parameter in event handlers

You can find this using IE Developer tool
In image below I have process group which I want to hide:

Process Group Visible

Now if I hide process group , (elem.style.visibility = ‘hidden’;), it looks like:
Process Group Hidden

If I want to remove process group, [(elem.parentNode).removeChild(elem);]
it will look like this:
Process Group Removed

Hope this helps someone 🙂

Advertisements

3 thoughts on “CRM 2011: Hide/Remove Ribbon Item (Javascript)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s