A button on the command bar is hidden when it should be visible in Power Apps
Artikkeli
Applies to: Power Apps Original KB number: 4552163
Determine why a button is hidden
A button can be hidden due to an enable rule or display rule on the command associated with the button evaluating to false. It could be that the associated command has a Mscrm.HideOnModern display rule that would hide the button in Unified Interface applications. A HideCustomAction could also have been created that would force the button to be hidden. If the user is offline, custom commands and default commands without the Mscrm.IsEntityAvailableForUserInMocaOffline enable rule won't be displayed.
Warning
Any display rule of the EntityPrivilegeRule type with a PrivilegeType value of one of the following (Create, Write, Delete, Assign, Share) will evaluate to false if the entity has the Read-Only in Mobile option enabled, which will force the entity to only permit Read privilege. Examples of some of the most common default system rules that will evaluate to false when the Read-Only in Mobile flag is enabled on the entity, are as follows, but not limited only to this list (Mscrm.CreateSelectedEntityPermission, Mscrm.CanSavePrimary, Mscrm.CanWritePrimary, Mscrm.CanWriteSelected, Mscrm.WritePrimaryEntityPermission, Mscrm.WriteSelectedEntityPermission, Mscrm.CanDeletePrimary, Mscrm.DeletePrimaryEntityPermission, Mscrm.DeleteSelectedEntityPermission, Mscrm.AssignSelectedEntityPermission, Mscrm.SharePrimaryPermission, Mscrm.ShareSelectedEntityPermission). You can edit the entity and uncheck the Read-Only in Mobile option to permit these rules to evaluate to true, provided the privilege being tested by the rule is also granted to the user.
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 following example shows the New button on the contact entity's grid page isn't visible and is represented by an item labeled New (hidden).
Note
If your button isn't listed, it could be due to a HideCustomAction customization that may have been installed, or the associated command has a Mscrm.HideOnModern display rule. At the time of writing this guide, the Command Checker tool does not list buttons that have been hidden by a HideCustomAction or Mscrm.HideOnModern display rule. We are currently working to augment this listing to include this information in a future update.
Note
If the button is still hidden when all rules evaluate to True, it may be due to context sensitive commands in grids. When records are selected on a grid, all buttons without a SelectionCountRule element will be considered not relevant to the selected record(s). And they're hidden even if their rule evaluation is True. Note that flyouts aren't affected since flyout children might still have record based commands.
Select the Command Properties tab to display the details of the command for this button. This will show the enable rules and display rules, along with the result (True, False, Skipped) of each rule evaluation. The following example shows the New (hidden) button's command to be Mscrm.NewRecordFromGrid and there's an enable rule named new.contact.EnableRule.EntityRule that has evaluated to False, as a result the button will be hidden.
Expand the new.contact.EnableRule.EntityRule enable rule, by selecting on the chevron
icon to view the details of the rule. To understand why a rule evaluates to True or False requires a little understanding of the type of rule. For details of each type of rule, see Define ribbon enable rules, and Define ribbon display rules. The following example shows that the rule type is Entity and the entity logical name is account. Since the current entity is contact, which isn't equal to account, this rule returns False.
The approach needed to fix a button's visibility will depend on the various customizations in your specific scenario. Considering our example:
If this rule was created erroneously, such that the entity declared in the rule was intended to be contact but was set to account, you could edit the new.contact.EnableRule.EntityRule enable rule and make changes that would permit the rule to evaluate to true.
If this rule was added to the command unintentionally, you could modify the Mscrm.NewRecordFromGrid command and remove the new.contact.EnableRule.EntityRule enable rule from the command definition.
If the command is an override of a Microsoft published definition, then this custom version of the command could 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.
If there's another solution layer that contains a working definition of the command, then you can delete the definition to restore the 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.
In order to delete a command, we need to determine which solution installed the customization:
Select the View command definition solution layers link below the command name to view the solution(s) that installed a definition of the command.
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 aren't 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 aren't 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.
Selecting Back will return to the previous Command Checker window.
The following image shows the solution layers for the command in our example, and indicates that there's a solution layer for the contact entity that it's an unmanaged customization as denoted by the solution titled Active. Your actual scenario may differ, you may not have an Active solution layer, you may have a managed solution and the name of that solution will be listed here.
Now that we have reviewed the solution layers and identified the solution that installed the customization, we must fix the definition in the appropriate solution.
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 contact and the command that needs to be deleted is Mscrm.NewRecordFromGrid and it's declared in the Active unmanaged solution layer from a publisher named DefaultPublisherCITTest.
Open Advanced Settings.
Navigate to Settings > Solutions.
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)
Select Entities > Add Existing.
Select the entity your command is defined on (In our example, this is contact) and select OK.
Make sure you uncheck the Include entity metadata and Add all assets options before selecting Finish.
Select Save.
Select Export Solution and export the unmanaged solution.
Extract the .zip file.
Open the customizations.xml file.
Locate the <Entity> node child of the entity node you wish to edit and locate its child <RibbonDiffXml> node.
Locate the <CommandDefinition> node. (In our example, ID of the <CommandDefinition> node is Mscrm.NewRecordFromGrid, so we would locate the following node)
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.NewRecordFromGrid.)
Save the customizations.xml file.
Add the modified customizations.xml file back to the solution .zip file.
Import the solution file.
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:
Open Advanced Settings.
Navigate to Settings > Solutions.
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.
Select Export Solution and export the unmanaged solution.
Extract the .zip file.
Open the customizations.xml file.
Locate the root <RibbonDiffXml> node.
Locate the <CommandDefinition> node.
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 <CommandDefinitions> nodes that may be present.
Save the customizations.xml file.
Add the modified customizations.xml file back to the compressed solution .zip file.
Import the solution file.
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:
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.
Increment the Version of your custom solution.
Export solution as managed.
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.
How to fix an enable/display rule
Select the View rule definition solution layers link below the rule name to view the solution(s) that installed a definition of the rule.
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 aren't 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 aren't 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.
Selecting Back will return to the previous Command Checker window.
The following image shows the solution layers for the enable rule in our example, and indicates that there's one solution layer in this case, and that it's an unmanaged customization as denoted by the solution titled Active. Your actual scenario may differ, you may not an Active solution layer, you may have a managed solution and the name of that solution will be listed here.
Now that we have reviewed the solution layers and identified the solution that installed the customization, we must fix the definition in the appropriate solution.
Select one of the following options that matches your particular scenario:
The enable/display rule is in the unmanaged Active solution
To fix an enable/display rule 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 the new version of this solution containing the fixed enable/display rule definition. See Export, prepare to edit, and import the ribbon.
The enable/display rule is entity-specific
Based on our example scenario, we identified the entity is contact and the enable rule that needs to be fixed is new.contact.EnableRule.EntityRule and it's declared in the Active unmanaged solution layer from a publisher named DefaultPublisherCITTest.
Open Advanced Settings.
Navigate to Settings > Solutions.
Select New to create a new solution, set Publisher to the value shown in the Command Checker's solution layers listing for the enable rule and the Active solution layer. (In our example, this is DefaultPublisherCITTest)
Select Entities.
Select Add Existing.
Select the entity your enable/display rule is defined on (In our example, this is contact) and select OK.
Make sure you uncheck the Include entity metadata and Add all assets options before selecting Finish.
Select Save.
Select Export Solution and export the unmanaged solution.
Extract the .zip file.
Open the customizations.xml file.
Locate the <Entity> node child of the entity node you wish to edit and locate its child <RibbonDiffXml> node.
Locate the enable/display rule. (In our example, ID of the enable rule is new.contact.EnableRule.EntityRule, so we would locate the following node)
Edit the <RibbonDiffXml> node and make the necessary changes to the enable/display rule that will permit the rule to evaluate to True under the correct circumstances to fix the rule. For more help about declaring rules, see Define ribbon enable rules, and Define ribbon display rules. (Based on our example, we would change the rule definition to the following)
Add the modified customizations.xml file back to the solution .zip file.
Import the solution file.
Select Publish All Customizations.
The enable/display rule is in the Application Ribbon (applies to "All entities")
If the enable/display rule 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:
Open Advanced Settings.
Navigate to Settings > Solutions.
Select New to create a new solution, set Publisher to the value shown in the Command Checker's solution layers listing for the enable/display rule and the Active solution layer.
Select Export Solution and export the unmanaged solution.
Extract the .zip file.
Open the customizations.xml file.
Locate the root <RibbonDiffXml> node.
Locate the enable/display rule.
Edit the <RibbonDiffXml> node and make the necessary changes to the enable/display rule that will permit the rule to evaluate to True under the correct circumstances to fix the rule. For more help about declaring rules, see Define ribbon enable rules, and Define ribbon display rules.
Add the modified customizations.xml file back to the solution .zip file.
Import the solution file.
Select Publish All Customizations.
The enable/display rule is from a custom-managed solution that I authored
To fix an enable/display rule that was installed by a custom-managed solution that you created, follow these steps:
In your separate development organization that has the unmanaged source version of your custom solution, complete the steps listed above for the The enable/display rule is in the unmanaged Active solution option.
Increment the Version of your custom solution.
Export solution as managed.
In your separate affected organization, Import this new version of your custom-managed solution.
The enable/display rule is from a custom-managed solution that I did not author or my organization does not own (from a third-party/ISV)
To fix an enable/display rule 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 contains the fixed enable/display rule definition and install this new solution into your affected organization.
The enable/display rule is in a Microsoft published managed solution
To fix an enable/display rule that was installed by a Microsoft published managed solution, you may need a newer version of the solution to be installed, which would typically be done during a release update. It's possible that you have identified a bug that still needs to be fixed. Contact customer support for assistance.
How to fix a command
In order to fix a command, we need to determine which solution installed the customization.
Select the View command definition solution layers link below the command name to view the solution(s) that installed a definition of the command.
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 aren't 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 aren't 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.
Selecting Back will return to the previous Command Checker window.
The following image shows the solution layers for the command in our example, and indicates that there's one solution layer in this contact, and that it's an unmanaged customization as denoted by the solution titled Active. Your actual scenario may differ, you may not have an Active solution layer, you may have a managed solution and the name of that solution will be listed here.
Now that we have reviewed the solution layers and identified the solution that installed the customization, we must fix the definition in the appropriate solution.
Select one of the following options that matches your particular scenario:
The command is in the unmanaged Active solution
To fix 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 containing the fixed command definition. See Export, prepare to edit, and import the 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 command is entity-specific
Based on our example scenario, we identified the entity is contact and the command that needs to be fixed is Mscrm.NewRecordFromGrid and it's declared in the Active unmanaged solution layer from a publisher named DefaultPublisherCITTest.
Open Advanced Settings.
Navigate to Settings > Solutions.
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)
Select Entities.
Select Add Existing.
Select the entity your command is defined on (In our example, this is contact) and select OK.
Make sure you uncheck Include entity metadata and Add all assets options before selecting Finish.
Select Save.
Select Export Solution and export the unmanaged solution.
Extract the .zip file.
Open the customizations.xml file.
Locate the <Entity> node child of the entity node you wish to edit and locate its child <RibbonDiffXml> node.
Locate the <CommandDefinition> node. (In our example, ID of the <CommandDefinition> node is Mscrm.NewRecordFromGrid, so we would locate the following node)
Edit the <RibbonDiffXml> node and make the necessary changes to the <CommandDefinition> node that will permit the command to function properly under the correct circumstances to fix the command. For more help about declaring commands, see Define ribbon commands. (Based on our example, we would modify the <CommandDefinition> node by removing the new.contact.EnableRule.EntityRule enable rule that is causing the button to be hidden.)
Add the modified customizations.xml file back to the solution .zip file
Import the solution file.
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:
Open Advanced Settings.
Navigate to Settings > Solutions.
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.
Select Export Solution and export the unmanaged solution.
Extract the .zip file.
Open the customizations.xml file.
Locate the root <RibbonDiffXml> node.
Locate the <CommandDefinition> node.
Edit the <RibbonDiffXml> node and make the necessary changes to the <CommandDefinition> node that will permit the command to function properly under the correct circumstances to fix the command. For more help about declaring commands, see Define ribbon commands.
Add the modified customizations.xml file back to the solution .zip file.
Import the solution file.
Select Publish All Customizations.
The command is from a custom-managed solution that I authored
To fix a command that was installed by a custom-managed solution that you created, follow these steps:
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.
Increment the Version of your custom solution.
Export solution as managed.
In your separate affected organization, Import this new version of your custom-managed solution.
The command is from a custom-managed solution that I did not author or my organization does not own (from a third-party/ISV)
To fix 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 contains the fixed command definition and install this new solution into your affected organization.
The command is in a Microsoft published managed solution
To fix a command that was installed by a Microsoft published managed solution, you may need a newer version of the solution to be installed, which would typically be done during a release update. It's possible that you have identified a bug that still needs to be fixed. Contact customer support for assistance.