Design Auto Complete Text controls in Dynamics CRM 2016

By | December 12, 2015

Introduction:

On Dec 1st Microsoft released another great version of Dynamics CRM – CRM 2016 that has loads of new features and not to forget developer enhancements too.

One of the developer enhancements added to Dynamics CRM 2016 is “Auto Complete” which allows us to provide auto complete feature for the single line text fields.

Configuring a control for Auto-Complete

Let us take an example to provide an auto complete list of cities for the City field on an entity.

In the above source code, we have used three newly added functions in CRM 2016.

  1. showAutoComplete()
  2. hideAutoComplete()
  3. addOnKeyPress()
  1. showAutoComplete()

This function is use to show the drop down list based on the string entered by the user in the text box. In our example, if you type “A” in the text box then it will display all the cities starting with “A” as shown below.Design Auto Complete Text controls

  1. hideAutoComplete()

This function is use to hide the hide the drop down list. Or else you can simply click anywhere on the form then also this drop down list will get hide.

  1. addOnKeyPress()

This function is called whenever we type any character in the text box.

Xrm.Page.getControl(“address1_city”).addOnKeyPress(keyPressFcn);

So to make this Auto complete functionality work, we need to call the function on the form load as shown below. In this example, we have called “ListOfCities” function on form load as shown below.

Design Auto Complete Text controls in crm 2016

Conclusion:

With auto-complete feature becoming a part of our daily use on the web, this now helps us provide a quick lookup to possible allowed values, without requiring the field to be converted into a Lookup.

Just not this, before moving to the next post please visit Maplytics InfoCentre – Bing Maps Integration for Microsoft Dynamics CRM.

Leave a Reply