Ribbon Troubleshooting Guide

Applies to: Dynamics CRM OnlineDynamics 365PowerApps

If you are experiencing an issue in a Dynamics 365 or Power Apps model-driven application with a ribbon command bar button, this guide can help you find and solve the problem.

We will use an in-app tool called the Command Checker to inspect the ribbon component definitions to help us determine what might be causing problems.

Note: This guide is only applicable to the Unified Interface applications and not applicable to the legacy Web Client interface.

 

The first step is to choose one of the items from this list of the most common types of ribbon command bar problems.

Which of the following best describes your ribbon issue?

The first step is to choose one of the items from this list of the most common types of ribbon command bar problems.

Which of the following best describes your ribbon issue?

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 display rule "Mscrm.HideOnModern" 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 enable rule "Mscrm.IsEntityAvailableForUserInMocaOffline" won’t be displayed. 

Warning: Any display rule of type EntityPrivilegeRule with a PrivilegeType value of one of the following ("Create" | "Write" | "Delete" | "Assign" | "Share" ) will evaluate to false if the entity has "Read-only in mobile" 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 "Read-only in mobile" to permit these rules to evaluate to true, provided the privilege being tested by the rule is also granted to the user.

 

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

We will use an in-app tool called the Command Checker to inspect the ribbon component definitions to help us determine why the button is hidden.

To enable the Command Checker, you must append a parameter &ribbondebug=true to your D365 application URL. For example: https://yourorgname.crm.dynamics.com/main.aspx?appid=9ab590fc-d25e-ea11-a81d-000d3ac2b3e6&ribbondebug=true

Command Checker - Enabling

Note: Currently the Command Checker 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 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" 

Command checker button icon
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 should be displayed.
  2. Locate the command bar that the button is expected to be shown in.
  3. Click the "Command checker" 
    Command checker button icon
    button (it may be listed in the  "More" overflow flyout menu) 
  4. Find and click your button in the list of buttons displayed in the left most pane of the command Checker. Buttons that are not visible will be denoted by deemphasized and italicized font along with the term "(hidden)". The following example shows the "New" button on the contact entity's grid page is not visible and is represented by an item labelled "New (hidden)".

    Note: If your button is not listed, it could be due to a HideCustomAction customization that may have been installed, or the associated command has a display rule "Mscrm.HideOnModern". At the time of writing this guide, the Command Checker does not list buttons that have been hidden by a HideCustomAction or the "Mscrm.HideOnModern" display rule. We are currently working to augment this listing to include this information in a future update.

    Command Checker - Contact - New Button
  5. Click 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 is an enable rule named "new.contact.EnableRule.EntityRule" that has evaluated to False, as a result the button will be hidden.

    Command Checker - Contact - New Command - Rules
  6. Expand the enable rule "new.contact.EnableRule.EntityRule", by clicking 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, please refer to 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 is not equal to "account", this rule returns False.

    Command Checker - Contact - New Command - Rule Expanded
  7. The approach needed to fix a button's visibility will depend on the various customizations in your specific scenario. Considering our example, suppose this rule was created erroneously, such that the entity declared in the rule was intended to be "contact" but was set to "account". We could edit the enable rule "new.contact.EnableRule.EntityRule" and make changes that would permit the rule to evaluate to true. Or perhaps, this rule was added to the command unintentionally. We could modify the command "Mscrm.NewRecordFromGrid" and remove the enable rule "new.contact.EnableRule.EntityRule" from the command definition. Or 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.

    Select one of the repair options below:

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 is 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.

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

We will use an in-app tool called the Command Checker to inspect the ribbon component definitions to help us determine why the button is visible unexpectedly.

To enable the Command Checker, you must append a parameter &ribbondebug=true to your D365 application URL. For example: https://yourorgname.crm.dynamics.com/main.aspx?appid=9ab590fc-d25e-ea11-a81d-000d3ac2b3e6&ribbondebug=true

Command Checker - Enabling

Note: Currently the Command Checker 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 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" 

Command checker button icon
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. Click the "Command checker" 
    Command checker button icon
    button (it may be listed in the  "More" overflow flyout menu) 
  4. Find and click your button in the list of buttons displayed in the left most pane of the command Checker. Buttons that are not visible will be denoted by deemphasized and italicized font along with the term "(hidden)". 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.

    Command Checker - Appointment - Button
  5. Click 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 is possible the rule is incorrectly customized or the necessary circumstances to return a false result are not met. If this is the case, skip to step 9, otherwise it is possible then that the command is missing a rule or rules and we will view the command solution layers for further analysis.

    Command Checker - Appointment - Command
  6. Click the "View command definition solution layers" link below the command name to view the solution(s) that installed a definition of the command.

    Command Checker - Appointment - Command - View Solution Layers
  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 is 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 click "Compare' to view a comparison of the definitions brought in by each solution.

    Clicking "Back" will return to the previous Command Checker window.

     

    Note: At the time of writing this guide, the Command Checker's Solution Layers pane has a bug that may list an unmanaged "Active" solution layer below other layers even though it is expected to always be on top. This same bug may also list custom managed solutions not published by Microsoft below other Microsoft published solution layers even though they are expected to be just below the unmanaged "Active" solution layer and above Microsoft solution layers, or if there is no unmanaged "Active" solution layer, then it would be expected to be the top layer. Regardless of the order placement in this list, when an unmanaged "Active" solution layer is present, it will always be the definition the application uses. Regardless of the order placement in this list, any custom managed solutions that are not published by Microsoft will also take precedence over Microsoft published solution layers, if there is no unmanaged "Active" solution layer. This bug has been fixed and is expected to be deployed with release train 4.1 to online regions starting in April 2020. 



    If there is 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 is not listed at the top, select the Active solution layer and then the top row) and click "Compare".

    Command Checker - Appointment - Command - Solution Layers
  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.

    Command Checker - Appointment - Command - Solution Layers - Compared
  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 is possible that the requirements that would make the rule return false are not met, such as a field value or security privilege is not correctly assigned. Depending on your rule definition, the requirements can vary greatly, please refer to Define ribbon enable rules, and Define ribbon display rules.  Considering our example, the command was customized with the removal of a display rule "Mscrm.HideOnModern". 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 display rule "Mscrm.HideOnModern" to the command definition. Since this is a custom override of a Microsoft published definition and there are no other intentional modifications, it is recommended that this custom version of the command be deleted to restore the default functionality.

Please select one of the following repair options:

There are several factors that can cause a button's action to not work correctly. These are usually due to invalid ribbon customizations where the button's associated command definition is incorrectly declared. 

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

If a command is not properly declared, clicking on a button may either simply do nothing or display an error.

Please select one of the following options that best matches your situation to help us provide the best resolution:

  1. Click "View rule definition solution layers" link below the rule name to view the solution(s) that installed a definition of the rule.

    Command Checker - Contact - New Command - Rule Solution Layers Link
  2. 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 is 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 click "Compare' to view a comparison of the definitions brought in by each solution.

    Clicking "Back" will return to the previous Command Checker window.

     

    Note: At the time of writing this guide, the Command Checker's Solution Layers pane has a bug that may list an unmanaged "Active" solution layer below other layers even though it is expected to always be on top. This same bug may also list custom managed solutions not published by Microsoft below other Microsoft published solution layers even though they are expected to be just below the unmanaged "Active" solution layer and above Microsoft solution layers, or if there is no unmanaged "Active" solution layer, then it would be expected to be the top layer. Regardless of the order placement in this list, when an unmanaged "Active" solution layer is present, it will always be the definition the application uses. Regardless of the order placement in this list, any custom managed solutions that are not published by Microsoft will also take precedence over Microsoft published solution layers, if there is no unmanaged "Active" solution layer. This bug has been fixed and is expected to be deployed with release train 4.1 to online regions starting in April 2020. 



    The following image shows the solution layers for the enable rule in our example, and indicates that there is one solution layer in this case, and that it is 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. 

    Command Checker - Contact - New Command - Rule - Solution Layers
  3. 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.
     

 

In order to fix a command, we need to determine which solution installed the customization.

  1. Click "View command definition solution layers" link below the command name to view the solution(s) that installed a definition of the command.

    Command Checker - Contact - New Command Solution Layers Link
  2. 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 is 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 click "Compare' to view a comparison of the definitions brought in by each solution.

    Clicking "Back" will return to the previous Command Checker window.

     

    Note: At the time of writing this guide, the Command Checker's Solution Layers pane has a bug that may list an unmanaged "Active" solution layer below other layers even though it is expected to always be on top. This same bug may also list custom managed solutions not published by Microsoft below other Microsoft published solution layers even though they are expected to be just below the unmanaged "Active" solution layer and above Microsoft solution layers, or if there is no unmanaged "Active" solution layer, then it would be expected to be the top layer. Regardless of the order placement in this list, when an unmanaged "Active" solution layer is present, it will always be the definition the application uses. Regardless of the order placement in this list, any custom managed solutions that are not published by Microsoft will also take precedence over Microsoft published solution layers, if there is no unmanaged "Active" solution layer. This bug has been fixed and is expected to be deployed with release train 4.1 to online regions starting in April 2020. 



    The following image shows the solution layers for the command in our example, and indicates that there is one solution layer in this contact, and that it is 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. 

    Command Checker - Contact - New Command Solution Layers
  3. 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.

To fix an enable/display rule in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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

     

    To fix an enable/display rule that was installed by a custom managed solution that you created, you must complete the steps listed above for the option labelled "The enable/display rule is in the unmanaged Active solution" in your separate development organization that has the unmanaged source version of your custom solution used to create your custom managed solution. Once you have completed those steps, then you will export a new managed version of your solution that can be imported into your target affected organization to fix the customizations.

    1. In your separate development organization that has the unmanaged source version of your custom solution, complete the steps listed above for the option labelled "The enable/display rule is in the unmanaged Active solution"
    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

    To fix an enable/display rule that was installed by a custom managed solution that was created by a third-party/ISV, you will 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. 

    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 is possible that you have identified a bug that still needs to be fixed. Please contact customer support for assistance.

    If there is 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:

    1. Click "View command definition solution layers" link below the command name to view the solution(s) that installed a definition of the command.

      Command Checker - Contact - New Command Solution Layers Link
    2. 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 is 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 click "Compare' to view a comparison of the definitions brought in by each solution.

      Clicking "Back" will return to the previous Command Checker window.

       

      Note: At the time of writing this guide, the Command Checker's Solution Layers pane has a bug that may list an unmanaged "Active" solution layer below other layers even though it is expected to always be on top. This same bug may also list custom managed solutions not published by Microsoft below other Microsoft published solution layers even though they are expected to be just below the unmanaged "Active" solution layer and above Microsoft solution layers, or if there is no unmanaged "Active" solution layer, then it would be expected to be the top layer. Regardless of the order placement in this list, when an unmanaged "Active" solution layer is present, it will always be the definition the application uses. Regardless of the order placement in this list, any custom managed solutions that are not published by Microsoft will also take precedence over Microsoft published solution layers, if there is no unmanaged "Active" solution layer. This bug has been fixed and is expected to be deployed with release train 4.1 to online regions starting in April 2020. 



      The following image shows the solution layers for the command in our example, and indicates that there is a solution layer for the "contact" entity that it is 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. 

      Command Checker - Contact - New Command Solution Layers
    3. 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:

    To fix a command in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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 "Mscrm.HideOnModern" display rule from a command to force a button to appear in the Unified Interface. Commands that have the display rule Mscrm.HideOnModern are intended for the legacy Web Client interface and are not supported in the Unified Interface, and may not work correctly.

     

    To fix a command that was installed by a custom managed solution that you created, you must complete the steps listed above for the option labelled "The command is in the unmanaged Active solution" in your separate development organization that has the unmanaged source version of your custom solution used to create your custom managed solution. Once you have completed those steps, then you will export a new managed version of your solution that can be imported into your target affected organization to fix the customizations.

    1. In your separate development organization that has the unmanaged source version of your custom solution, complete the steps listed above for the option labelled "The command is in the unmanaged Active solution"
    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

    To fix a command that was installed by a custom managed solution that was created by a third-party/ISV, you will 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. 

    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 is possible that you have identified a bug that still needs to be fixed. Please contact customer support for assistance.

    To delete a command in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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

     

    To delete a command that was installed by a custom managed solution that you created, you must complete the steps listed above for the option labelled "The command is in the unmanaged Active solution" in your separate development organization that has the unmanaged source version of your custom solution used to create your custom managed solution. Once you have completed those steps, then you will export a new managed version of your solution that can be imported into your target affected organization to fix the customizations.

    1. In your separate development organization that has the unmanaged source version of your custom solution, complete the steps listed above for the option labelled "The command is in the unmanaged Active solution"
    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

    To delete a command that was installed by a custom managed solution that was created by a third-party/ISV, you will 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. 

    If you are getting a Script Error that is similar to the following:

    "Invalid JavaScript Action Library: [script name] is not a web resource and is not supported."

    Script Error - Invalid JavaScript Action Library - is not a web resource

    This is caused by an invalid ribbon command customization that has declared an incorrect Library on the command's JavaScriptFunction.

    We will use an in-app tool called the Command Checker to inspect the ribbon component definitions to help us determine how to fix this issue.

    To enable the Command Checker, you must append a parameter &ribbondebug=true to your D365 application URL. For example: https://yourorgname.crm.dynamics.com/main.aspx?appid=9ab590fc-d25e-ea11-a81d-000d3ac2b3e6&ribbondebug=true

    Command Checker - Enabling

    Note: Currently the Command Checker 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 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" 

    Command checker button icon
    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 displayed in.
    3. Click the "Command checker" 
      Command checker button icon
      button (it may be listed in the  "More" overflow flyout menu) 
    4. Find and click your button in the list of buttons displayed in the left most pane of the command Checker to show the button and command properties. The following example shows the "New" button on the account entity's form page is visible and is represented by an item labelled "New".

      Command Checker - Command - Invalid JavaScript Action Library - New button
    5. Click the "Command Properties" tab to display the details of the command for this button. This will display the Actions and JavaScriptFunction declaration as well as any enable/display rules, along with the result (True, False, Skipped) of each rule evaluation. 

      Expand the JavaScriptFunction, by clicking on the "chevron"  icon to view the details of the function declaration. The Library property must be a JavaScript web resource and be prefixed with "$webresource:". The following example shows that the Library property is "/_static/_common/scripts/RibbonActions.js", which is not a path to a valid JavaScript web resource. We should next review the solution layers of the command to attempt to identify the correct value to fix the issue.

      Command Checker - Command - Invalid JavaScript Action Library
    6. Click "View command definition solution layers" link below the command name to view the solution(s) that installed a definition of the command.

      Command Checker - Command - Invalid JavaScript Action Library - View Solution Layers
    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 is 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 click "Compare' to view a comparison of the definitions brought in by each solution.

      Clicking "Back" will return to the previous Command Checker window.

       

      Note: At the time of writing this guide, the Command Checker's Solution Layers pane has a bug that may list an unmanaged "Active" solution layer below other layers even though it is expected to always be on top. This same bug may also list custom managed solutions not published by Microsoft below other Microsoft published solution layers even though they are expected to be just below the unmanaged "Active" solution layer and above Microsoft solution layers, or if there is no unmanaged "Active" solution layer, then it would be expected to be the top layer. Regardless of the order placement in this list, when an unmanaged "Active" solution layer is present, it will always be the definition the application uses. Regardless of the order placement in this list, any custom managed solutions that are not published by Microsoft will also take precedence over Microsoft published solution layers, if there is no unmanaged "Active" solution layer. This bug has been fixed and is expected to be deployed with release train 4.1 to online regions starting in April 2020. 



      The following image shows the solution layers for the command in our example, and indicates that there is two solution layers, and one is an unmanaged customization as denoted by the solution titled "Active" and the other is from the System solution published by Microsoft. 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. 

      Select the top two rows and click "Compare' to view a comparison of the definitions brought in by each solution. If you only have one solution layer, then you will skip this step.

      Command Checker - Command - Invalid JavaScript Action Library - Solution Layers
    8. The comparison between command definitions will show any differences that may exist between the two layers. The following example clearly shows that the Library value is different. The unmanaged entry from the Active solution is set to an incorrect path "/_static/_common/scripts/RibbonActions.js" (your specific path may be slightly different) and the default definition from Microsoft has set the Library to "$webresoure:Main_system_library.js", which is a supported path for this particular command (this value may be different depending on your particular command). The only supported path is one that begins with "$webresource:" and ends with the name of a valid JavaScript web resource.

      Command Checker - Command - Invalid JavaScript Action Library - Solution Layers Comparison
    9. 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:

    When a button is clicked and nothing happens, this is typically caused by an incorrect configuration of the command associated with the button.

    The following command configuration mistakes when declaring the action's JavaScriptFunction can result in a button to seem as though it does nothing when clicked:

    • Invalid FunctionName - If the name of the JavaScript function does not match a valid function name in the JavaScript web resource that is assigned to the Library property, then the button will do nothing.
    • Invalid Library - If this path is not referring to a valid JavaScript web resource or is not prefixed with "$webresource:", then the button will not work.
    • Missing parameters - If the JavaScript function is expecting specific parameters and the command definition does not declare them, then the button won't function properly.
    • Incorrect parameter type or order - If the parameters are declared with an incorrect type or are in a different order than how they are listed in the JavaScript function declaration, then the button may not work as expected.

    Please refer to Define ribbon actions for additional configuration help.

    If the above configurations are correct, it is possible that there is JavaScript code error. If the custom JavaScript function is coded incorrectly and simply does not invoke the expected behavior, then the button will fail to work as anticipated.  If you identify one of the above configuration mistakes, fix the command definition to resolve the issue. Otherwise, you may need to debug and fix the JavaScript function code for the button to work correctly.

    Let's identify what the button's command is and what solution installed the definition.

    We will use an in-app tool called the Command Checker to inspect the ribbon component definitions to help us determine why the button click results in an error.

    To enable the Command Checker, you must append a parameter &ribbondebug=true to your D365 application URL. For example: https://yourorgname.crm.dynamics.com/main.aspx?appid=9ab590fc-d25e-ea11-a81d-000d3ac2b3e6&ribbondebug=true

    Command Checker - Enabling

    Note: Currently the Command Checker 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 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" 

    Command checker button icon
    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 visible in.
    3. Click the "Command checker" 
      Command checker button icon
      button (it may be listed in the  "More" overflow flyout menu) 
    4. Find and click your button in the list of buttons displayed in the left most pane of the command Checker. Buttons that are not visible will be denoted by deemphasized and italicized font along with the term "(hidden)". Buttons that are visible will be displayed with the label in the normal font. Click the "Command Properties" tab to display the details of the command for this button.

      Command Checker - Button Error - Button
    5. The "Command properties" will display the Actions and corresponding JavaScriptFunction configuration. Click the "View command definition solution layers" link below the command name to view the solution(s) that installed a definition of the command.

      Command Checker - Button Error - Command
    6. 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 is 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 click "Compare' to view a comparison of the definitions brought in by each solution.

      Clicking "Back" will return to the previous Command Checker window.

       

      Note: At the time of writing this guide, the Command Checker's Solution Layers pane has a bug that may list an unmanaged "Active" solution layer below other layers even though it is expected to always be on top. This same bug may also list custom managed solutions not published by Microsoft below other Microsoft published solution layers even though they are expected to be just below the unmanaged "Active" solution layer and above Microsoft solution layers, or if there is no unmanaged "Active" solution layer, then it would be expected to be the top layer. Regardless of the order placement in this list, when an unmanaged "Active" solution layer is present, it will always be the definition the application uses. Regardless of the order placement in this list, any custom managed solutions that are not published by Microsoft will also take precedence over Microsoft published solution layers, if there is no unmanaged "Active" solution layer. This bug has been fixed and is expected to be deployed with release train 4.1 to online regions starting in April 2020. 



      If there is only one solution layer, skip to step 8, otherwise, select the top two solution layers (If you have a layer in the Active solution, but it is not listed at the top, select the Active solution layer and then the top row) and click Compare.

      Command Checker - Button Error - Command - Solution Layers
    7. 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 by specifying the FunctionName incorrectly as compared to the other inactive definition in the Microsoft published System solution layer. The FunctionName is expected to be "XrmCore.Commands.Delete.deletePrimaryRecord", but the custom definition has declared the FunctionName="deletePrimaryRecord" which will result in nothing happening when the button is clicked since the function cannot be found.

      Command Checker - Command - Does Nothing - Solution Layers Compared
    8. The approach needed to fix a button's action functionality will depend on the various customizations in your specific scenario. Considering our example, the command was customized by specifying an incorrect FunctionName. We could modify the custom version of the command and fix the FunctionName. Since this is a custom override of a Microsoft published definition and there are no other intentional modifications, it is recommended that this custom version of the command be deleted to restore the default functionality.

    Please select one of the following repair options:

    When a ribbon command bar button is clicked and an error occurs, it is typically caused by incorrect ribbon command customizations.

    Please select one of the following options that best matches your situation:

    When a button is clicked and an error occurs, it may be caused by an incorrect configuration of the command associated with the button or by incorrectly coded JavaScript.

    Let's identify what the button's command is and what solution installed the definition.

    We will use an in-app tool called the Command Checker to inspect the ribbon component definitions to help us determine why the button click results in an error.

    To enable the Command Checker, you must append a parameter &ribbondebug=true to your D365 application URL. For example: https://yourorgname.crm.dynamics.com/main.aspx?appid=9ab590fc-d25e-ea11-a81d-000d3ac2b3e6&ribbondebug=true

    Command Checker - Enabling

    Note: Currently the Command Checker 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 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" 

    Command checker button icon
    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 visible in.
    3. Click the "Command checker" 
      Command checker button icon
      button (it may be listed in the  "More" overflow flyout menu) 
    4. Find and click your button in the list of buttons displayed in the left most pane of the command Checker. Buttons that are not visible will be denoted by deemphasized and italicized font along with the term "(hidden)". Buttons that are visible will be displayed with the label in the normal font. Click the "Command Properties" tab to display the details of the command for this button.

      Command Checker - Button Error - Button
    5. The "Command properties" will display the Actions and corresponding JavaScriptFunction configuration. Click the "View command definition solution layers" link below the command name to view the solution(s) that installed a definition of the command.

      Command Checker - Button Error - Command
    6. 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 is 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 click "Compare' to view a comparison of the definitions brought in by each solution.

      Clicking "Back" will return to the previous Command Checker window.

       

      Note: At the time of writing this guide, the Command Checker's Solution Layers pane has a bug that may list an unmanaged "Active" solution layer below other layers even though it is expected to always be on top. This same bug may also list custom managed solutions not published by Microsoft below other Microsoft published solution layers even though they are expected to be just below the unmanaged "Active" solution layer and above Microsoft solution layers, or if there is no unmanaged "Active" solution layer, then it would be expected to be the top layer. Regardless of the order placement in this list, when an unmanaged "Active" solution layer is present, it will always be the definition the application uses. Regardless of the order placement in this list, any custom managed solutions that are not published by Microsoft will also take precedence over Microsoft published solution layers, if there is no unmanaged "Active" solution layer. This bug has been fixed and is expected to be deployed with release train 4.1 to online regions starting in April 2020. 



      If there is 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 is not listed at the top, select the Active solution layer and then the top row) and click Compare.

      Command Checker - Button Error - Command - Solution Layers
    7. 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 by specifying the first parameter incorrectly as compared to the other inactive definition in the Microsoft published System solution layer. The function is expecting a single id of the primary record as declared by the CrmParameter named "FirstPrimaryItemId", but the custom definition has declared the CrmParameter "PrimaryItemIds" which will cause the script to throw an error because the parameters do not match the function signature.

      Command Checker - Button Error - Command - Solution Layers Compared
    8. The approach needed to fix a button's action functionality will depend on the various customizations in your specific scenario. Considering our example, the command was customized by specifying the first parameter incorrectly. We could modify the custom version of the command and fix the parameter. Since this is a custom override of a Microsoft published definition and there are no other intentional modifications, it is recommended that this custom version of the command be deleted to restore the default functionality.

    Please select one of the following repair options:

    To fix a command in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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 "Mscrm.HideOnModern" display rule from a command to force a button to appear in the Unified Interface. Commands that have the display rule Mscrm.HideOnModern are intended for the legacy Web Client interface and are not supported in the Unified Interface, and may not work correctly.

     

    The approach to fix the command will vary depending if your definition is the only one, or if there are other inactive definitions, and whether or not the changes were intentional.

    Please select the option that reflects your scenario:

    To delete a command in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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

     

    If there is 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:

    If there are modifications to the command that you need to retain, but you still want the button to be hidden under the appropriate circumstances, then you can add the missing enable/display rules to the command instead of deleting the custom definition.

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

    To delete a command in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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

     

    If you determined that enable/display rules are missing from your command definition, then you can modify the CommandDefinition and add the rules to achieve the desired behavior. To fix a command in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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

     

    To fix a command in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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 "Mscrm.HideOnModern" display rule from a command to force a button to appear in the Unified Interface. Commands that have the display rule Mscrm.HideOnModern are intended for the legacy Web Client interface and are not supported in the Unified Interface, and may not work correctly.

     

    To delete a command in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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

     

    To fix a command in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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 "Mscrm.HideOnModern" display rule from a command to force a button to appear in the Unified Interface. Commands that have the display rule Mscrm.HideOnModern are intended for the legacy Web Client interface and are not supported in the Unified Interface, and may not work correctly.

     

    To delete a command in the "Active" unmanaged solution layer, we will export an unmanaged solution containing the entity or Application Ribbon and edit the RibbonDiffXml 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