Hiding a Group of Ribbon Buttons in CRM 2011

 

Scenario:  Removing the Actions group of buttons from the Opportunity screens (removing the Close as Won, Close as Lost, and Recalculate Opportunity buttons).

i.e.:  Before:

image

and After:

image

 

There are 2 parts to customising the Ribbon:

1. Determine the ID of the ribbon component you want to change

2. Add a custom action to the relevant entity’s exported customisation file to ‘request’ a change to that ribbon component

 

To figure out the ID browse to the following SDK folder…

\\sdk\SampleCode\CS\Client\Ribbon\ExportRibbonXml\ExportedRibbonXml\

.. and have a look at the ribbon definition for the entity involved.  In our case this is the file  opportunityribbon.xml.

[UPDATE: 14 Dec 2011 – The latest SDK did not include the ribbon definition XML files forcing you to build and run an app from source code provided in order to generate them for your self. I provide instructions on this process here]

There are separate ribbon definitions for: the main grid view of an entity, the related grid view, and the form.  In our case these buttons appear on the main grid view and on the form but not on the related grid ribbon, so there are 2 changes we need to make.

Ribbons are defined as a collection of tabs.  Each tab has Groups.  Each Group has buttons.

In your case we can either try and remove each of the 3 buttons or remove the entire “Actions” group they sit in.  I’m going to go with removing the entire Group because that’s bound to be easier and also I suspect there’s a 4th “Reopen Opportunity” button that will conditionally appear in that group and I want that hidden as well. 

clip_image002

The Tabs we are after and the Groups on those Tabs are as per below:

clip_image003

 

Now here’s the trap for young players, we don’t make changes to the opportunityribbon.xml.  It’s included in the SDK only as a reference.  Instead, we need to make our changes to the Opportunity entity itself by exporting and editing its customisation XML. 

 

Here’s the steps:

1. Create a new Solution called OppEntityOnly

2. Add the Opportunity entity to the Solution

3. Export the Solution and unzip it

4. Open the exported customization.xml file in Visual Studio (or NotePad if you don’t have VS)

5. Do a FIND on <RibbonDiffXml>

6. Replace  <CustomActions /> with the below:

<CustomActions > 
  <HideCustomAction Location="Mscrm.HomepageGrid.opportunity.MainTab.Actions" 
                    HideActionId="Mscrm.HomepageGrid.opportunity.MainTab.Actions.HideAction" /> 
  <HideCustomAction Location="Mscrm.Form.opportunity.MainTab.Actions" 
                    HideActionId="Mscrm.Form.opportunity.MainTab.Actions.HideAction" /> 
</CustomActions>

Note: the Location attributes refer to the Group ID’s I identified in the opportunityribbon.xml file

7. Save.

8. Re-zip

9. Import

10. Publish

11. Refresh your browser

 

Hope this helps Smile

Advertisements

5 thoughts on “Hiding a Group of Ribbon Buttons in CRM 2011

  1. Michael Dodd

    I’m trying to find out if you can conditionally hide ribbon elements. Do you know if this is possible?
    For eg, you can conditionally enable or disable buttons based on Enable rules, but I don’t see anything in the SDK for the HideAction…

    Reply
  2. Pingback: CRM2011 Hide button and group. -Kevin's Mocha

  3. Pingback: CRM2011 Ribbon Button Custom rules. -Kevin's Mocha

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