Introduction
Have you encountered a scenario where a custom button on the Sub-Grid command bar disappears when selecting a record? It is frustrating, but there is an easy resolution. Read on to fix this issue.
Symptoms
The custom button intended to appear on HomePageGrid or Subgrid upon creation through Ribbon workbench in Microsoft Dynamics CRM online doesn’t display as expected.
As per Microsoft documentation, “In UCI, this button will appear when no grid items are selected, but once one or more grid items are selected, the button disappears.”
Image: Showing a sub-grid in Microsoft Dynamics CRM online with a button “Intake Link.”
Image: Showing a sub-grid in Microsoft Dynamics CRM online with a button “Intake Link” disappeared upon record selection.
Cause
UCI has transitioned to be more context-sensitive. The buttons that don’t require an item to be selected will not display when an item is selected.
The Context is determined by whether the command behind the ribbon button has a SelectionCount rule. If it has SelectionCount, it is an item–specific command.
Fix / Resolution
If you are trying to fix the issue through the Ribbon Workbench Tool, you need to add an enable rule to the underlying button command with the step SelectionCountRule. See below.
Image: Showing SelectionCountRule being added to the button command.
When you publish and refresh the form, the button will be visible when selecting a record.
Note
You can also play around with SelectionCountRule such that the button shows up for only one or a certain number of selected records.
Alternatively, if you are seeking to fix the issue by modifying the XML you can add the below command.
<EnableRule Id="Mscrm.AnySelection" />
Summary
In this article, I discussed how we resolve the issue button not showing upon selecting one or more records on the sub-grid in Microsoft Dynamics 365 CE online.
Let me know if this was helpful to you and if you are still facing any issues.