Geolocation is the identification of the real-world geographic location of an object. Geolocation is closely related to the use of positioning systems but may be distinguished from it by a greater emphasis on determining a meaningful location (e.g. a street address) rather than just a set of geographic coordinates. The word geolocation is also the latitude and longitude coordinates of a particular location.
A managed form can be configured to display a map control to either display an existing location as a pin on a map or to provide the ability for the user to specify a location.
If the form or Address Line field is editable and this field is blank, then when the page loads it will prompt the user asking if they would like to share their location. If they choose to share their location then the map will be updated with their currently detected location. The pin on the map will also be draggable to allow the user to refine the location. If the user chooses not to share their location they can manually specify the location address parts in the fields provided and the mapping service will be queried to find the location and update the latitude and longitude as well as reposition the pin on the map accordingly.
In order to add geolocation functionality to a managed form, the following tasks must be completed.
Edit the Dynamics 365 entity form using the form designer and make the following modifications:
- Create a new section and provide an appropriate label, for example, Map. This section will contain map.
- Set the name of the section to "section_map" or a name that ends with "section_map", for example, contoso_section_map. This name is important as the form engine looks for a section with name to determine when to render a map.
- Add a new or existing field that will store the formatted address and add it to the Map section created in the previous step.
- Create a new section and provide an appropriate label, for example, Location. This section will contain the address fields for the selected location.
- Add the required address fields to the Location section created in the previous step. For example:
- Address Line
- Zip/Postal Code
The resulting form should look similar to the following. You may choose different display names for these fields as desired. You may also choose to layout these sections anyway you prefer.
Geolocation with map functionality on Managed Forms requires configuration settings in order to complete requests with the mapping service REST endpoint. The following Site Settings are used to configure the location service.
|Bingmaps/credentials||Unique key to authenticate requests to the Bing Maps API. Visit www.bingmapsportal.com to create a Bing Maps account and get a key. Required.|
|Bingmaps/restURL||URL to the Bing Maps REST API. Optional. If a value is not specified the default http://dev.virtualearth.net/REST/v1/Locations is used.|
The map control requires additional configuration to tell it what the ids of the various location fields are in order to assign/retrieve values to/from them. The configuration depends on the type of managed form.