Challenge #2 – Geocode customers

As customers are created or modified, their addresses are automatically geocoded and their location are stored in a set of new fields on the Customer table. A factbox showing the current location of the customer on a map is added to the Customer Card and links to open a large map or get directions are available as well. As a bonus, you can create an action, which will display all customers within a certain range on a map.

Expected result

Click image to see animation:Challenge #2


To complete this challenge, you will need:

  • A Dynamics 365 Business Central Development Environment
  • Visual Studio Code with the AL Extension installed
    • Azure VMs will have VS Code pre-installed
  • A BingMaps API Key from (Public WebSite or Dev/Test key)


  • Create an empty app
  • Create a table extension for the customer table and add fields
  • Create a page extension for the customer card and add fields
  • On the OnBeforeModify and OnBeforeInsert triggers on the Customer table, geocode the customer address using BingMaps API
  • Create a CardPart page showing a map of the geocoded position
  • Create an action opening a browser with all customers as shared places


  • In VS Code, use Ctrl+Shift+P and type AL GO and remove the customerlist page extension
  • Use the ttableext, the tfield and the tkey snippets
  • Use the tpageext and the tpagefield snippets
  • Use HttpClient to communicate with the Web Service and use Json types (JsonObject, JsonToken, JsonArray and JsonValue) to extract values from the Web Service result
  • Use tpage snippet and add usercontrol with the WebPageViewer Use to see the html you can use In the control.
  • Add location of all customers to the sp parameter as explained here:

Cheat Sheets


Freddy Kristiansen

Passwords: Biza5514, Repe6676, Vady4574, Huwa2666, Dahi8208, Bamu6541, Xepe8513

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s