Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications

|

Double Down with CRM 2016: Introducing Two New Features - Web API and Autocomplete

Post Author: Joe D365 |

Microsoft Dynamics CRM 2016 introduced two new CRM client-side API additions: Web API and Autocomplete. In today's blog, we will go over both of these new features and show you how they can be used. Let's get started!

Web API

The Web API is replacing the Organization Service. It implements OData v4, which allows the same operations as the Organization Service without needing CRM SDK assemblies. This is a BIG deal, as complex applications can be created across a variety of platforms and programming languages without the limitation of OData v2 CRUD only operations. Actions and Functions are operations performed via HTTP requests. The Organization Service (OData v2 REST endpoint) has been deprecated for CRM 2016.

Here is where you find the new Web API URL: Settings à Customizations à Developer Resources.

Web API and Autocomplete

Want to learn more about the new Web API? Check out this blog post!

Autocomplete

Autocomplete was added to the API in Dynamics CRM 2016. It provides a quick and easy way to pick a value from a predefined list, improves the user experience in forms, and helps with data quality in the system.

In out-of-the-box CRM, the Address fields are all plain text. Country, State and Zip Code fields are good candidates for autocomplete fields. In the steps below, we will demonstrate how to retrieve Countries from a custom entity via the Web API and display it on an autocomplete field. Autocomplete data source is not limited to custom entities. External sources can be used as well.

The setup: Country entity with Name and Country ISO Code fields:

Web API and Autocomplete

Register the loadAutoComplete function in the Form Load event:

Web API and Autocomplete

The code: The function below retrieves all Country names and codes, sorted by country name, form the custom po_country entity and calls the autoCompleteCountries function passing the list of countries as a parameter.

Web API and Autocomplete

The function autoCompleteCountries is implemented with the code below. The autocomplete feature is simple to use, but please note that two methods and one event handler are needed: addOnKeyPress, showAutoComplete and hideAutoComplete.

  • showAutoComplete: Displays the autocomplete drop-down field when there is a match between what the user typed in the Address1: Country/Region field and any Country name or ISO code.
  • hideAutoComplete: Hides the autocomplete drop-down field when no matches are found.
  • addOnKeyPress: The keyPressFcn is called every time a user types a character in the Address1: Country/Region field.

Web API and Autocomplete

This is what it all looks like in action:

Web API and Autocomplete

Check out the video here to see it all in action:


That's all for the blog today! Keep coming back for more information on the great new features of Microsoft Dynamics CRM.

Happy CRM'ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

2 comments on “Double Down with CRM 2016: Introducing Two New Features - Web API and Autocomplete”

  1. Hi,

    In loadAutocompleted funtion , You have called one funtion autocompleteCountries(countries), We are not getting definition of this function autocompleteCountries(countries)

PowerObjects Recommends