Hiding a Ribbon Button in CRM 2011

 

Scenario:  Removing the Qualify button from the Lead screens

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…

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  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:

image

 

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

7. Save.

8. Re-zip

9. Import

10. Publish

11. Refresh your browser

 

Hope this helps Smile

11 thoughts on “Hiding a Ribbon Button in CRM 2011

  1. Pingback: Editing Ribbon Buttons in CRM 2011 « Gareth Tucker's Microsoft CRM Blog

  2. Meg

    This blog is of so much help. The SDK documentation on ribbons is quite cumbersome. Thanks!
    I have a question – I have a custom sub area called “online orders” in the left navigation menu of the sales group. (just below “orders”). This just takes you to a web page so it is not really related to any entity within the CRM. When I added this to the navigation menu using the sitemap, CRM automatically added a ribbon called “Home” to it which has buttons “New Activity”, “New Record”, “Import Data”, “Advanced Find”. I want to get rid of some of these buttons – which file will have the button ids for these? And where should I make the custom action changes since it is not under a particular entity?

    Reply
    1. Gareth Tucker Post author

      I suspect the definition of that ribbon is in applicationribbon.xml and you can customise by creating and exporting a solution with just the Application Ribbons component as per this post: http://gtcrm.wordpress.com/2011/01/19/adding-a-button-to-the-main-crm-ribbon-in-2011/

      The tricky bit will be restricting your change to just this one scenario, not sure how to do that. I wonder whether you could create a dummy entity add that to your site map but in your site map definition define it so that your custom sub area appears rather than the entity. Then you would have an entity you can specify in your ribbon customisation. Might work.

      Reply
  3. Naveed Anwar

    This article was very helpful. Thanks!

    Tweak: When doing the find for the RibbonDiffXml, need to confirm that it is for the correct entity(there may be several). I wanted to fix Opportunity but it required that I download dependent items as well…which lead to multiple entities being in the customization file….so confirm which RibbonDiffXml you are working on otherwise it will error out during the Import.

    Reply
    1. Gareth Tucker Post author

      You don’t have to download the dependent items. I never do. If you only want to change one entity during the solution export/import process it makes sense to only include that 1 entity in your solution file. It will happily re-import even without the dependent items as they will be present in the environment. The dependent items warning is only relevant when importing into a different environment. :)

      Reply
  4. Puneet Joshi

    How hide the system button lets say deactivate button based on security role using your approach.

    I can see if i use the above approach it will hide the button permanently.
    Let me know if you can help me out here. i am seeking some help.

    Thanks.

    Reply
    1. Gareth Tucker Post author

      Hi, refer to the post on instructions on how to edit a ribbon button: http://gtcrm.wordpress.com/2011/08/24/editing-ribbon-buttons-in-crm-2011/

      You will need to add a display rule to the existing button, here’s more info on display rules: http://msdn.microsoft.com/en-us/library/gg328560.aspx

      Rather than basing on a specific role you might need to base on a specific priviledge that is unique to that role, using either EntityPrivilegeRule or MiscellaneousPrivilegeRule.

      HTH

      Reply
  5. Swaroop

    Hi,

    Great article!
    Question – I have configured my outlook with CRM. I have a custom Qualify page that i use instead of the OOB Qualify page. For the custom qualify page, I have created a custom ribbon button and have kept the OOB Qualify ribbon button hidden form the user.

    On outlook though, when I right-click on any lead record, I have the OOB Qualify button visible. I need to remove/hide this Qualify button too. Is there a way to do it?

    Could you please suggest what should be done for this?

    Reply
    1. Gareth Tucker Post author

      Hi, sorry not aware of a silutiin to this. I doubt there will be a supported approach (other than perhaps a plugin that disallows a lead qualification via the ootb process, assuming a plugin can spot the difference)

      Reply
      1. Swaroop

        Hey,

        Thanks for the immediate response.
        Yes, even I am unable to find a way to hide it.
        Will research more. Thanks !

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