CRM 2011 Data Entry Grids

Written By: Tyler Sand

from August 10, 2012

Over the years, we have received many requests from customers for data entry grids within Microsoft Dynamics CRM.  In CRM 2011, web resources have significantly expanded the possibilities for developing such tools.  For this particular project, I have chosen to use Silverlight as my development platform, though other options such as HTML/Javascript do exist.  My goal was to create a data entry grid that behaved as closely to a CRM form as possible.  In this article, I am going to focus on two of the design considerations that made this happen; lookups and data validation.


To mimic the CRM 2011 lookups as closely as possible, I used StackPanel, Image, AutoCompleteBox, TextBlock, HyperlinkButton and Button controls.  Using a combination of these controls allows me to create a lookup that had icons, hyperlinks to launch the associated records, automatic resolutions, and the ability to launch a lookup dialog to populate the value.  The behavior of the AutoCompleteBox control behaves slightly different than the native form lookups, however for this project the result was more than acceptable and there probably are additional customizations that could be done via additional events and controls.

Data Validation

One convenient feature of the Silverlight DataGrid control is that it performs automatic data type validation.  For example, if plain text is entered into a date field, it will display an error stating that the “Input is not in a correct format”. 

This validation is a great start, however there is additional validation that must be performed to ensure that the data meets the CRM platform’s requirements.  For example, dates in CRM must have a fiscal year between 1900 and 2100, and numeric values must meet the minimum and maximum constraints configured on each field.  To add this addition layer of validation, ValidationExceptions can be used within each get/set method of the entity class.

public DateTime peak_paymentdate


get { return _peak_paymentdate; }



if (_peak_paymentdate != value)


if (value.Year > 1900 && value.Year < 2100)


UpdateEntity(“peak_paymentdate”, value);

_peak_paymentdate = value;




throw new ValidationException(“The specified date format is invalid or is out of the valid range. Specify a valid fiscal year in the format: yyyy, where yyyy is a fiscal year between 1900 and 2100.”);





The result is that whenever data is entered into a field on the grid that does not meet the specified validation criteria, an error will be displayed and the user will be unable to change focus to another field until it is corrected.

In summary, these two design considerations, coupled with many others, have resulted in a data entry grid with a familiar feel and experience for end users.  The grid can be conveniently embedded into a dashboard, form, or any other place that allows web resources.