Scenario: Removing the Actions group of buttons from the Opportunity screens (removing the Close as Won, Close as Lost, and Recalculate Opportunity buttons).
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 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.
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 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
11. Refresh your browser
Hope this helps