Dynamics 365 Business Central: Getting geographical location information from the client device (Latitude, Longitude)

Dynamics 365 Business Central

Hi, Readers.
Today I would like to share another mini tip of Business Central, how to get geographical location information from the client device.

This time we will use codeunit 7568 Geolocation.

Codeunit 7568 Geolocation: Provides functionality for getting geographical location information from the client device.

Let’s see a simple example.

Source Code:

pageextension 50100 CustomerListExt extends "Customer List"
    trigger OnOpenPage();
        Geolocation: Codeunit Geolocation;
        Latitude: Decimal;
        Longitude: Decimal;
        Msg: Label 'Latitude is %1.\Longitude is %2.';
        if Geolocation.RequestGeolocation() then begin
            Geolocation.GetGeolocation(Latitude, Longitude);
            Message(Msg, Format(Latitude), Format(Longitude));

First, you must allow Business Central to access data about the geographical location of the device.

PS: You can click the Location icon on the browser to manage the Location permission.

Then you can get the latitude and longitude of your device.

1. More details for Geolocation Module:

ALAppExtensions/Modules/System/Geolocation at main · microsoft/ALAppExtensions
Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central. - ALAppExtensions/Modul...

2. If you want to know how to use online maps in Business Central, hope the following can help you.
How to use online maps (Bing maps and Google maps)


Hope this will help.

Thanks for reading.



Copied title and URL