Walkthrough: Hide Ribbon Elements

[Applies to: Microsoft Dynamics CRM 2011]

This walkthrough describes how to hide ribbon groups and individual controls for several different entities by using a <HideCustomAction> (RibbonDiffXml) element.

Tip

A managed solution that includes the goal of this walkthrough is available in the SDK download at SDK\Walkthroughs\Ribbon\HideRibbonElements.zip.

Because it is a managed solution, you can install (import) it to view the customized ribbon. You can then uninstall (delete) it to remove it from the system.

If you install this managed solution, make sure that you uninstall it before you try the walkthrough steps.

Note

Because a <HideCustomAction> (RibbonDiffXml) only removes a specified node from the ribbon, removing ribbon elements in this manner may not be the best option for every situation.

  • If you want to remove a button that is associated with a specific privilege, you should adjust the privileges for the entity in the security roles in your implementation. This will allow the default ribbon display, and enables rules that hide or disable ribbon elements from users without the necessary privileges to perform those actions.

  • If you want to replace an existing ribbon element with a custom ribbon element, you can overwrite that element by specifying a <CustomAction> (RibbonDiffXml) with a Location attribute value identical to the existing element.

Prerequisites

Before you can begin, you must have a clear set of requirements.

the following are the requirements that will be met in this walkthrough:

  1. For quotes, remove the Data group from the Quotes tab on the homepage grid.

    • Before: Quote grid with Data group

      The Data group in Quote grid is visible.

    • After: Quote grid with Data group removed

      The Data group in Quote grid is not present

  2. For leads, remove the Qualify button in the Actions group from the Leads tab on the homepage grid.

    • Before: Lead grid with Qualify button

      The Qualify button in the Lead grid is visible

    • After: Lead grid with Qualify button removed

      The Qualify button in the Lead grid is not present

  3. For Leads, remove the Qualify button in the Actions group from the form.

    • Before: Lead form with Qualify button

      The Qualify button in the Lead form is visible.

    • After: Lead form with Qualify button removed

      The Qualify button in the Lead form is not present

Export the Entities

  1. You can export the whole default solution, including the Quote and Lead entities, but to minimize the total file size, we recommend that you create a new solution and add these entities to it.

    Create a New Solution

    1. For more information, see Export, Prepare to Edit, and Import the Ribbon.
  2. Export the Solution

    1. For more information, see Export, Prepare to Edit, and Import the Ribbon.

Identify the Ids for Existing Items

  1. Use the following files included in the SDK download SDK\Resources\ExportedRibbonXml to identify the Id value for each item you want to remove:

    • quoteRibbon.xml

    • leadRibbon.xml

  2. The value for the Data group from the Quotes tab on the homepage grid is 'Mscrm.HomepageGrid.quote.MainTab.ExportData'.

  3. For the Qualify button in the Actions group for the Leads tab:

    • For the homepage grid ribbon the value is 'Mscrm.HomepageGrid.lead.ConvertLead'.

    • For the form ribbon the value is 'Mscrm.Form.lead.ConvertLead'.

Edit the customizations.xml File

  1. Extract the compressed solutions file.

  2. Open the customizations.xml file.

    Tip

    Although you can edit the customization.xml file by using any text editor, we recommend that you use Microsoft Visual Studio or another XML editing application that supports XSD schema validation. This will help avoid XML validation errors when you import the ribbon.

    Associate the customizations.xml file with the customizationsSolution.xsd file You can find this schema in the SDK\Schemas\CustomizationsSolution.xsd file in the SDK download package.

    For more information, see Prepare to edit the XML.

  3. Locate the default RibbonDiffXml node for each entity as shown in the following example:

    <RibbonDiffXml>
     <CustomActions />
     <Templates>
      <RibbonTemplates Id="Mscrm.Templates">
      </RibbonTemplates>
     </Templates>
     <CommandDefinitions />
     <RuleDefinitions>
      <TabDisplayRules />
      <DisplayRules />
      <EnableRules />
     </RuleDefinitions>
     <LocLabels />
    </RibbonDiffXml>
    
  4. For the Quote entity, add a <HideCustomAction> (RibbonDiffXml) with the Location attribute set to the value that you identified earlier as shown in the following example:

    <RibbonDiffXml>
      <CustomActions >
        <HideCustomAction Location="Mscrm.HomepageGrid.quote.MainTab.ExportData"
                          HideActionId="Sample.HomepageGrid.quote.MainTab.ExportData.HideAction" />
      </CustomActions>
      <Templates>
        <RibbonTemplates Id="Mscrm.Templates">
        </RibbonTemplates>
      </Templates>
      <CommandDefinitions />
      <RuleDefinitions>
        <TabDisplayRules />
        <DisplayRules />
        <EnableRules />
      </RuleDefinitions>
      <LocLabels />
    </RibbonDiffXml>
    
  5. For the Lead entity, for both the form ribbon and the homepage grid ribbon, add two <HideCustomAction> (RibbonDiffXml) elements that use the Location attribute values set to the values that you identified earlier as shown in the following example:

    <RibbonDiffXml>
      <CustomActions >
        <HideCustomAction Location="Mscrm.Form.lead.ConvertLead"
                          HideActionId="Sample.Form.lead.ConvertLead.HideAction" />
        <HideCustomAction Location="Mscrm.HomepageGrid.lead.ConvertLead"
                          HideActionId="Sample.Form.HomepageGrid.ConvertLead.HideAction" />
      </CustomActions>
      <Templates>
        <RibbonTemplates Id="Mscrm.Templates">
        </RibbonTemplates>
      </Templates>
      <CommandDefinitions />
      <RuleDefinitions>
        <TabDisplayRules />
        <DisplayRules />
        <EnableRules />
      </RuleDefinitions>
      <LocLabels />
    </RibbonDiffXml>
    

Import and publish the solution

Test and Verify that the Requirements Are Met

  • Open Microsoft Dynamics CRM and verify the following:

    • In the Quotes grid, the Data group is not present on the Quotes tab.

    • In the Leads grid, the Qualify button is not in the Actions group of the Leads tab.

    • Open a lead record and confirm that the Qualify button is also not present in the form ribbon.

See Also

Tasks

Walkthrough: Add a Custom Button to an Existing Group for a Specific Entity
Walkthrough: Add a Custom Group to an Existing Tab for a Specific Entity
Walkthrough: Add a Custom Tab to a Specific Entity
Walkthrough: Add a Custom Button to an Existing Group for all Entities

Other Resources

Ribbon Walkthroughs

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.