A button on the command bar is visible when it should be hidden

Applies to:   Power Apps
Original KB number:   4552163

Determine why a button is visible

A button will be made visible if all the enable rules and display rules on the command associated with the button evaluate to true. If this is unexpected, it's possible that the command definition has been overridden and is missing enable rules or display rules, or the rule definitions themselves are overridden and causing the button to be visible when you expect it to be hidden.

Note

Some buttons are not customizable. For more information, see Non-customizable buttons in ribbon.

Warning

Do not remove the Mscrm.HideOnModern display rule from a command to force a button to appear in the Unified Interface. Commands that have the Mscrm.HideOnModern display rule are intended for the legacy Web Client interface and are not supported in the Unified Interface, and may not work correctly.

The in-app tool, Command Checker, will be used to inspect the ribbon component definitions to help us determine why the button is visible unexpectedly.

To enable the Command Checker tool, you must append a &ribbondebug=true parameter to your Dynamics 365 application URL. For example: https://yourorgname.crm.dynamics.com/main.aspx?appid=<ID>&ribbondebug=true.

Screenshot shows the parameter is appended to your Dynamics 365 application U R L.

Note

Currently the Command Checker tool only works in a web browser and does not work in Android and iOS apps. A future update is planned to make this work in these mobile apps.

Once the Command Checker tool has been enabled, within the application in each of the various command bars (global, form, grid, subgrid), there will be a new special "Command checker" button to open the tool (it may be listed in the More overflow flyout menu).

  1. Navigate to the page in the application where the button is displayed.

  2. Locate the command bar that the button is visible in.

  3. Select the "Command checker" button (it may be listed in the More overflow flyout menu).

  4. Find and select your button in the list of buttons displayed in the left-most pane of the Command Checker tool. Buttons that aren't visible will be denoted by de-emphasized and italicized font along with the (hidden) term. Buttons that are visible will be displayed with the label in the normal font. The following example shows there are two Appointment buttons on the activities grid page, and one is expected to be hidden.

    Screenshot shows there are two Appointment buttons on the activities grid page.

  5. Select the Command Properties tab to display the details of the command for this button. This will display the actions, enable rules, and display rules, along with the result (True, False, Skipped) of each rule evaluation. Review the enable rules and display rules, if you expect a particular rule should be evaluating to false, then it's possible the rule is incorrectly customized or the necessary circumstances to return a false result are not met. If so, skip to step 9, otherwise it's possible then that the command is missing a rule or rules and we'll view the command solution layers for further analysis.

    Screenshot to select the Command Properties tab to display the details of the command for this button.

  6. Select the View command definition solution layers link below the command name to view the solution(s) that installed a definition of the command.

    Screenshot of the View command definition solution layers link below the command name.

  7. The Solution Layers pane will display the layering of each ribbon component definition a particular solution has installed. The layer at the top of the list is the current definition that is used by the application, the other layers are inactive and are not used by the application at the moment. If the top solution is uninstalled or an updated version is installed that removes the definition, then the next layer will become the current active definition used by the application. When an unmanaged Active solution layer is present, it will always be the definition the application uses. If there's no Active solution listed, then the solution listed at the top of the list will be the definition used by the application. Any custom-managed solutions that are not published by Microsoft will also take precedence over Microsoft published solution layers.

    The Entity context indicates the object the ribbon customization is on, if "All Entities" is listed, then the layer is from the Application Ribbon client extensions and not entity specific, otherwise the logical name of the entity will be listed.

    When there are two or more layers, you can select two rows and select Compare to view a comparison of the definitions brought in by each solution.

    Clicking Back will return to the previous Command Checker window.

    If there's only one solution layer, skip to step 9, otherwise, select the top two solution layers (If you have a layer in the Active solution, but it isn't listed at the top, select the Active solution layer and then the top row) and select Compare.

    Screenshot to select the top two solution layers and select the Compare option.

  8. The comparison of the current active definition and the previous inactive definition will be displayed showing the differences, if any. The following example shows the unmanaged Active definition to have been customized with the removal of a display rule Mscrm.HideOnModern that is included in the inactive msdynce_ActivitiesPatch Microsoft published solution layer.

    Screenshot shows the comparison of the current active definition and the previous inactive definition.

  9. The approach needed to fix a button's visibility will depend on the various customizations in your specific scenario. If you determined that a rule is incorrectly evaluating to false, and if the rule definition is incorrectly defined, then you should modify the rule definition and make changes that would permit the rule to evaluate to false under the proper circumstances. If the rule definition is correct, then it's possible that the requirements that would make the rule return false are not met, such as a field value or security privilege isn't correctly assigned. Depending on your rule definition, the requirements can vary greatly, refer to Define ribbon enable rules, and Define ribbon display rules. Considering our example, the command was customized with the removal of a Mscrm.HideOnModern display rule. This display rule is intended to hide this particular button from being displayed in Unified Interface applications and only be visible in the legacy Web Client interface. We could modify the custom version of the command and add the missing the Mscrm.HideOnModern display rule to the command definition. Since this is a custom override of a Microsoft published definition and there are no other intentional modifications, it's recommended that this custom version of the command be deleted to restore the default functionality.

Repair Options

Select a repair option from one of the tabs below. The first tab is selected by default.

How to delete a command

If there's another solution layer that contains a working definition of this command, then you can delete this definition to restore the next inactive working definition.

If this is the only layer and you no longer need the command, then you can remove it from your solution if no other button is referencing the command.

Select one of the following options that matches your particular scenario:

The command is in the unmanaged Active solution

To delete a command in the Active unmanaged solution layer, we'll export an unmanaged solution containing the entity or Application Ribbon and edit the <RibbonDiffXml> node in the customizations.xml file, and then import a new version of this solution where this command has been removed in order to delete the component. See Export, prepare to edit, and import the ribbon.

The command is entity-specific

Based on our example scenario, we identified the entity is activitypointer and the command that needs to be deleted is Mscrm.CreateAppointment and it's declared in the Active unmanaged solution layer from a publisher named DefaultPublisherCITTest.

  1. Open Advanced Settings.

  2. Navigate to Settings -> Solutions.

  3. Select New to create a new solution, set Publisher to the value shown in the Command Checker's solution layers listing for the command and the Active solution layer. (In our example, this is DefaultPublisherCITTest).

  4. Select Entities.

  5. Select Add Existing.

  6. Select the entity your command is defined on (In our example, this is activitypointer) and select OK.

  7. Make sure you uncheck the Include entity metadata and uncheck Add all assets options before clicking Finish.

  8. Select Save.

  9. Select Export Solution and export unmanaged solution.

  10. Extract the .zip file.

  11. Open the customizations.xml file.

  12. Locate the <Entity> node child of the entity node you wish to edit and locate its child <RibbonDiffXml> node.

  13. Locate the <CommandDefinition> node (In our example, ID of the <CommandDefinition> node is Mscrm.CreateAppointment, so we would locate the following node).

    Screenshot shows the location of the CommandDefinition node.

  14. Edit the <RibbonDiffXml> node and remove the specific <CommandDefinition> node that has the ID of the command you wish to delete. Make sure you don't unintentionally delete other <CommandDefinition> nodes that may be present. (Based on our example, we would delete the <CommandDefinition> node in which ID is Mscrm.CreateAppointment.)

    Screenshot shows an example to delete the CommandDefinition node.

  15. Save the customizations.xml file.

  16. Add the modified customizations.xml file back to the solution .zip file.

  17. Import the solution file.

  18. Select Publish All Customizations.

The command is in the Application Ribbon (applies to "All entities")

If the command isn't entity-specific, rather it's applicable to "All Entities" declared in the Application Ribbon, then the steps will be slightly different as follows:

  1. Open Advanced Settings.
  2. Navigate to Settings > Solutions
  3. Select New to create a new solution, set Publisher to the value shown in the Command Checker's solution layers listing for the command and the Active solution layer.
  4. Select Client Extensions.
  5. Select Add Existing.
  6. Select Application Ribbons.
  7. Select Save.
  8. Select Export Solution and export unmanaged solution.
  9. Extract the .zip file.
  10. Open the customizations.xml file.
  11. Locate the root <RibbonDiffXml> node.
  12. Locate the <CommandDefinition>.
  13. Edit the <RibbonDiffXml> node and remove the <CommandDefinition> node that has the ID of the command you wish to delete. Make sure you don't unintentionally delete other <CommandDefinition> nodes that may be present.
  14. Save the customizations.xml file.
  15. Add the modified customizations.xml file back to the compressed solution .zip file.
  16. Import the solution file.
  17. Select Publish All Customizations.
The command is from a custom-managed solution that my company authored

To delete a command that was installed by a custom-managed solution that you created, follow these steps:

  1. In your separate development organization that has the unmanaged source version of your custom solution, complete the steps listed above for the The command is in the unmanaged Active solution option.
  2. Increment the Version of your custom solution.
  3. Export solution as managed.
  4. In your separate affected organization, Import this new version of your custom-managed solution.
The command is from a custom-managed solution that my company did not author (from third-party/ISV)

To delete a command that was installed by a custom-managed solution that was created by a third-party/ISV, you'll need to contact the author of the solution and request a new version of the solution that has removed the specific command definition and then install this new solution into your affected organization.