Friday 31 July 2015

Selection Count Rule - Display the ribbon command button only if a single record is selected in a list view or a landing page.


Last week, I was assigned a task to configure a ribbon command button on a list view page or a landing page for a lead entity. The requirement was that this button needs to be visible only if a user selects a single lead record in a list. In other words, the command button has to be invisible when user selects more than one lead record or all records or no records at a landing page grid.

In this post, I will explain how to create such rule that can full-fill the aforementioned need.

First, create a new command button for the lead entity using Ribbon Workbench tool, a well-known tool for changing ribbon buttons throughout Dynamics CRM system. It can be downloaded using following URL for Dynamics CRM 2013/2015 (

Refer the following Image 1 to insert a command button to the lead entity.


Image 1


  1. Create a new button by dragging and dropping it into Home area.
  2. Right click on Commands and add a new Command and fill its properties.
  3. Right click on Enable Rules to add a new Enable Rule.

Here, you would see an option to select a “Selection Count Rule”, as shown below in Image 2.


Image 2

Then, configure Edit Rule properties for “SelectionCountRule” as displayed in Image 3.


Image 3


Apply this newly created rule to the Command and assign that Command to a Button as described in Image 4.  

  1. Assign the Enable rule to the Command.
  2. Assign the Command to the Button.


Image 4

At last, Publish the customizations.

That’s it. With such simple enable rule we can configure a command button on landing page that could be visible on selection of single record and invisible when user selects more than one record for an entity.

Thank you for reading this post.


The simplest and quickest way to insert data for Many-to-Many relationship in Dynamics CRM is the Drag and drop listbox.