How to Get and Set Field Values in Dynamics 365 CRM using JavaScript

Customizing Dynamics 365 CRM using JavaScript allows you to dynamically retrieve and update field values, improving user experience and automation. This blog provides JavaScript examples for getting and setting different field types in Dynamics 365.

Getting Started

To begin, use the following function to get the form context:


function GetSet(executionContext) {
    var formContext = executionContext.getFormContext();
}

Now, let's explore different field types and how to work with them.

How to Get Latitude and Longitude from an Address Using Bing Maps API in JavaScript for D365

 

Getting Latitude & Longitude from an Address Using Bing Maps API


In Microsoft Dynamics 365, capturing latitude and longitude based on a given address is crucial for various business scenarios, such as the following:

  • Customer Location Tracking: Storing precise geolocation details for customers.

  • Field Service Optimization: Assigning technicians based on customer locations.

  • Sales Territory Management: Mapping sales territories.

To achieve this, we use the Bing Maps API to convert an input address into geographic coordinates (latitude and longitude) and auto-populate them in Dynamics 365 fields.