Assume there are three entities, as it is shown on Screen 1. The relations between those entities are displayed on Screens 2 and 3. Let’s create a cascading (master detail) lookup.

Microsoft Dynamics CRM

Screen 1

В Microsoft Dynamics CRM image

Screen 2

В Cascading Lookup in Microsoft Dynamics CRM

Screen 3

В Cascading Lookup in MS Dynamics CRM

Screen 4

City lookup should be configured to show only the cities that are relevant to the selected Country lookup value in the Addresses entity. Open the city field properties dialogue in the form (See Screen 5).

To do that:

  1. Open the desired solution.
  2. Select Addresses entity Г  Forms
  3. Open default form
  4. Select City Lookup
  5. Click on the Change Properties button

В How to create Cascading Lookup in Dynamics CRM

Screen 5

As a result, the window displayed on Screen 6 appears. Dialogue menu options can be modified to display only the relevant data (See Screen 6).

В Cascading Lookup

Screen 6

Now “City” displays the relevant data only. Still, there is a possibility to select a city and then a country not relevant to it. This may lead to non-synchronized data (Addresses Г  Country and Cities Г  Country). In this case, the incorrect data will be displayed to a user. But if the field is used in the business logic, it may cause even more troubles. To resolve this issue, validation of input data can be implemented on the SERVER side.

В How to solve synchronization issue with GUI

Add JavaScript to disable and reset City Lookup when the user changes Country.


function CascadingLookUpSample_Init() {

Xrm.Page.getControl(“ut_city”).setDisabled(crmForm.all.ut_country.DataValue == null);


function CascadingLookUpSample_CantryOnChange() {

crmForm.all.ut_city.DataValue = null;

Xrm.Page.getControl(“ut_city”).setDisabled(crmForm.all.ut_country.DataValue == null);


Now bind events to the abovementioned functions. (See Screen 7, 8)

To bind CascadingLookUpSample_Init() on the form load event:

  1. Open the form
  2. Click on the Form Properties ribbon button
  3. Select Events tab in the Form Properties dialogue
  4. Add library to the libraries section, if it wasn’t done earlier
  5. Select OnLoad event from the dropdown and click the Add button placed in the Event Handlers section
  6. Set up library and handler function name in Handler Properties dialogue

В Cascading Lookup in Dynamics CRM

Screen 7

To bind CascadingLookUpSample_CantryOnChange() to Country Lookup’s on change event:

  1. Select Country Lookup in the form
  2. Click on the Change property ribbon button
  3. Select Event tab in Field Properties dialogue
  4. Set up Library to CascadingLookUp and Function to CascadingLookUpSample_CantryOnChange

В Cascading Lookup in Microsoft CRM

В  Screen 8

В How to Add Custom View

В Create Cascading Lookup - CRM

Contact Us

To find out more about Abto Software expertise, request a quote or get a demo of your custom solution.

  • Clicking this button, I agree to the processing of my personal data.
Insert math as
Additional settings
Formula color
Text color
Type math using LaTeX
Nothing to preview