Hiding a Ribbon Button in CRM 2011
Scenario: Removing the Qualify button from the Lead screens
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…
.. and have a look at the ribbon definition for the entity involved. In our case this is the file leadribbon.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.
The Tabs we are after and the Groups on those Tabs are as per below:
Now here’s the trap for young players, we don’t make changes to the leadribbon.xml. It’s included in the SDK only as a reference. Instead, we need to make our changes to the Lead entity itself by exporting and editing its customisation XML. This is the second part of the 2-part process…
Here’s the steps:
1. Create a new Solution called LeadEntityOnly
2. Add the Lead entity to the Solution
3. Export the Solution and unzip it
4. Open the exported customisation.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.lead.ConvertLead" HideActionId="Mscrm.HomepageGrid.lead.ConvertLead.HideAction" /> <HideCustomAction Location="Mscrm.Form.lead.ConvertLead" HideActionId="Mscrm.Form.lead.ConvertLead.HideAction" /> </CustomActions>
Note: the Location attributes refer to the Button ID’s I identified in the leadribbon.xml file
11. Refresh your browser
Hope this helps