PowerObjects Blog 

for Microsoft Business Applications


A Little Code to Help You Hide a Ribbon Button in CRM 2011


A Little Code to Help You Hide a Ribbon Button in CRM 2011

As CRM Superheroes, we are often asked to conquer the impossible. Some tasks are difficult and some are easy as rescuing a dog from a burning building with your hands tied behind your back. Here we have a Microsoft Dynamics CRM "how-to" to make you look like a superhero in your organization: How to Hide a Ribbon Button in CRM 2011.

Prerequisite: Microsoft Dynamics CRM 2011 SDK

In this example we will hide the Assign Button in the lead entity form.

How to Hide a Ribbon Button in CRM 2011

First Step

  1. Identifying the ID value of the button that you want to hide.
  2. Open the folder SDKResourcesExportedRibbonXml from the SDK folder that you installed. And choose the xml file that is associated with lead entity (leadRibbon.xml in this example).
  3. Locate the button ID that points to assign button in the lead entity.

Second Step

  1. Create a solution with the lead entity , add to the soultion Application Ribbons from the Client Extensions tab.
  2. Export the solution.

Third step:

  1. Open the customizations.xml file from the solution folder.
  2. Modify the following code:

    <RibbonDiffXml>

    <CustomActions />

    <Templates>

    <RibbonTemplates

    Id="Mscrm.Templates">RibbonTemplates>

    Templates>

    <CommandDefinitions />

    <RuleDefinitions>

    <TabDisplayRules />

    <DisplayRules />

    <EnableRules />

    RuleDefinitions>

    <LocLabels />

    RibbonDiffXml>

To:

<RibbonDiffXml>

<CustomActions >

<HideCustomAction

Location="Mscrm.Form.lead.Assign"

HideActionId="Sample.Form.lead.Assign.HideAction" />

CustomActions>

<Templates>

<RibbonTemplates

Id="Mscrm.Templates">RibbonTemplates>

Templates>

<CommandDefinitions />

<RuleDefinitions>

<TabDisplayRules />

<DisplayRules />

<EnableRules />

RuleDefinitions>

<LocLabels />

RibbonDiffXml>

  1. Copy the file back to the solution folder and import the soltion.
  2. Publish the solution.

This should be the new result when you create a new lead entity:

So, there you have it--how to hide a ribbon button in CRM 2011. Hope this helps you and your organization work more efficiently. Are there other "how-to's" you would like answer? User the comments to let us know.

Happy CRM'ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

9 comments on “A Little Code to Help You Hide a Ribbon Button in CRM 2011”

  1. Hi!

    Great article! How would you do to hide a ribbon button based on a certain criteria? Let's say I would like to hide button for "create child record" if there already exists a child record. How would you do that?

  2. CustomActions> is a typo I think.
    Secondly, how exactly do you do this:
    Create a solution with the lead entity , add to the soultion Application Ribbons from the Client Extensions tab
    What I have done is the following: Create a solution, add the Activity object and Application Ribbons from the Client Extensions to it, saved and exported the solution, HideCustomAction to the right place but still on import I get an error saying  Sample.HomepageGrid.activitypointer.RunReport.HideAction is depending on Mscrm.HomepageGrid.activitypointer.RunReport.
     

  3. Figured it out, the HideAction has to be under the corresponding entity trees customactions. Somehow i added it to the last occurence of customactions instead 🙂 
    Great article!

  4. what my project requires is to hide group of buttons in the ribbon once a subgrid in the lead form is clicked. any help on this please.

  5. You can create a rule and then have a java script that set it to true or false under the
    tag
    or using the
    tag
    You will also need to associate a JavaScript function with the rule.

    Hope this helps! Happy CRM'ing.

    1. Hi,

      I would like to hide the entire ribbon,using java script, which consists of the save n other options on form load.
      Can anyone please help me out in this issue.

      Thanks.

  6. How to Remove the Campaign Response Ribbon?
    The Highlighted Ribbon.
    Cant find the button id location

  7. It was pretty simple solution. From "rescuing a dog from a burning building with your hands tied behind your back" I though you might be going to explain how to remove 'Share' button from 'Application Ribbon'. But just for 'Imports'. 'Share' button should not be removed for Reports, Articles, Queues etc.

PowerObjects Recommends