Button in command bar does not appear after grid item selection

Applies to: Dynamics CRM Online

Symptom


There is a custom button that is customized to appear in the grid (either HomePageGrid or a SubGrid).

In web client, this button will appear in the ribbon/command bar, regardless if grid items are selected or not.

In UCI, this button will appear when no grid items are selected, but once one or more grid items are selected, the button is gone.

Cause


As part of the design for UCI, we have changed the behavior to be more context sensitive.  Specifically, on grids, buttons are considered either "item specific" or not, and only item specific buttons are shown when one or more items are selected, while non "item specific" buttons are shown otherwise.

This means that buttons that do not require an item to be selected, will simply not be shown when a item is selected.  

The method that the determination is made is based on whether or not the command associated with the ribbon button has a SelectionCount rule.  If it has a SelectionCount rule, it is consdered to be an "item specific" command.

Note - flyouts and split buttons are excluded from this change, and still shown in both cases of when items are selected or not.  This is to ensure that menu items, some of which may be generated dynamically, is not incorrectly hidden.

Resolution


This is designed behavior, that effects all buttons, not just custom buttons, but out of box buttons as well (Note - flyouts and split buttons excluded since they have a menu with further child buttons and cannot be easily catagorized).  This is an explicit design change from web client to Unified Client.

In most cases, it is helpful to hide buttons that do not act on selected items, so that item specific commands appear more prominently.

If there is a strong scenario where users will need to run a generic command, unrelated to the items selected, during item selection, then the following workaround can be used:

In the definition of their Custom Ribbon Command, add the following rule:

            <EnableRule Id="Mscrm.AnySelection" />

This will cause the Unified Client to treat this command as both an item specific command, and a non-item specific command, and display in both cases.