16 Feb’16

Dynamics CRMAuto Complete feature in CRM 2016


In this blog we are going to discuss about the new Auto completion feature of CRM 2016. First, a disclaimer – the term ‘autocomplete’ might be a bit misleading since the field is not automatically completed but instead you can select the suggested item from the list.


To use the Country text field on the address section of the Account and Contact record to enter the Country but restricting users from entering any random values. Instead, the users need to enter country codes only. The goal was to accomplish this without using lookup field on the form.

For the text fields, the auto complete feature was not available in previous CRM versions. Hence instead of using text fields, we used to have either lookup fields (for many items) or option set fields (for limited set of options).


In CRM 2016, new methods are introduced for text fields. Using these methods, we can implement auto complete feature for text fields, where users can see the suggestions and either select any option or type its own value.
1. showAutoComplete
This method allows us to show list of possible values as dropdown to add auto complete feature to text fields. As soon as we select any item under the list, it will be populated in target text field and OnChange event of that field will fire.

Use this to show up to 10 matching strings in a drop- down list as users press keys to type character in a specific text field.

Also add a custom command with an icon at the bottom of the drop down list.

The above method can be used as follows:

Xrm.Page.getControl(field name).showAutoComplete(object);

This method takes object as parameter which includes results and command.

Object can be defined like below:

var resultset = { 
   results: [{ 
         id: <value1>, 
         icon: <url>, 
         fields: [<fieldValue1>]}], 
         id: <value>, 
         icon: <url>, 
         label: <value>, 
         action: <function reference> 

Here, the result represents an array of possible values that we want to show under the drop down on keypress. Under the results, we can define id, for individual array item, icon to show particular icon for array items and the field where we pass values.

Commands is used to define additional action on the drop down, for example opening any additional page by providing a link.

2. hideAutoComplete
This method is used to hide the auto complete drop down list that is implemented using showAutoComplete method.

No need to explicitly use this method because, by default, the drop down list hides automatically if the user clicks elsewhere or if a new drop down list is displayed.

The above method can be used as follows:

Xrm.Page.getControl(field name).hideAutoComplete()

Note: Both of above methods only works with Web and Outlook client.

Steps for creating an auto complete feature on single line text field are as follows:

  1. Save and publish script event OnLoad of the form.
  2. When user is going to type some character in auto complete text field, drop down list will display the list of records present. It will show only the first 10 results which are suggested.
  3. When user types some character in auto complete text field, the list of results matching the characters is shown in the drop-down.


This feature is useful when we have a master list of data from which users can select the value, at the same time users can also put data if they don’t find value in the master list.

Lookup approach was restricting users from selecting data only from master list and was not allowing users to put their own values.

One of the best example to this is list of Cities. Users can either select city from master list or if city is not available, then they can put their own value.

Current Limitations:

  1. Autocomplete does not work on phone/tablet native apps yet.
  2. Autocomplete works only on updated entity forms.

We hope this blog have given you useful information on the new Auto Complete feature of CRM. Contact us for any queries!


Written by

Team Member


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Dynamics 365 Client Diagnostics

    15 March’ 2018

    Main cause of Performance Issues: Bandwidth and latency are the primary characteristics which affects the performance o...

    Read more
  • Closing Blind Shift in MPOS and CPOS in Dynamics 365 for Retail

    15 March’ 2018

    Manual For closing Blind shift in POS: Blind shifts terminate the currently ongoing shift and when logged in a new shif...

    Read more
  • Persistent Filters in the Power BI Service

    13 March’ 2018

    Introduction: The feature is finally release, and it is power BI has announced general availability of persistent filt...

    Read more
  • Cause and Solution for Scribe MSMQ not receiving Message from AX

    10 March’ 2018

    Issue: Microsoft Message Queuing (MSMQ) service running on Server might be unable to receive messages. Therefore, messa...

    Read more
  • User Privileges on SharePoint – D365 Document Integration

    10 March’ 2018

    Overview: Often, we wonder what could be wrong where we see a generic error on Documents in Dynamics 365. Something lik...

    Read more