web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Check Environment Country

(1) ShareShare
ReportReport
Posted on by 213
How can I find the environment country via AL?
 
GetApplicationFamily() gives the base app W1
 
I have the same question (0)
  • Gerardo Rentería García Profile Picture
    25,398 Most Valuable Professional on at
    Hi
    You can use this.
    Get environments and Get environments by application family
    Business Central Admin Center API - Environments - Business Central | Microsoft Learn
    BR
    GR
  • Ajay Jain Profile Picture
    213 on at
    Thanks for quick answer
     
    I need something to write in codeunit without calling api
     
    I think I just need country code
  • YUN ZHU Profile Picture
    96,041 Super User 2025 Season 2 on at
    As far as I know, using AL can only obtain Microsoft Entra tenant country letter code. But this is not the country of BC environment, it is the entire Entra Tenant.
    codeunit 433 "Azure AD Tenant"
     
    Hope this helps.
    Thanks.
    ZHU
  • AJ-05070558-0 Profile Picture
    25 on at
    Thank you YUN ZHU, quite impressed with your blogs
    I have used your IP address blog
     
     
  • Suggested answer
    YUN ZHU Profile Picture
    96,041 Super User 2025 Season 2 on at
    Yes, this is much simpler than using OAuth authentication to get the standard API.
  • Suggested answer
    Mohana Yadav Profile Picture
    61,017 Super User 2025 Season 2 on at
    Or 
    Simply use below code
    Message(CopyStr(ApplicationSystemConstants.ApplicationVersion(), 1, 2));
  • Suggested answer
    YUN ZHU Profile Picture
    96,041 Super User 2025 Season 2 on at
    Hi, Mohana.
    As far as I know, this can only get the version of the Base App, just like codeunit 457 "Environment Information" -> procedure GetApplicationFamily().
    This cannot get the Country Code.
     
     
    Thanks
    ZHU
  • AJ-05070558-0 Profile Picture
    25 on at
    Hi Mohana,
     
    I tested as you suggested but I am getting W1
     
    GetApplicationFamily() or ApplicationVersion() is good for 22 countries but when you have base W1 then it does not work.
     
    Thank you
    Ajay Jain
     
  • Mohana Yadav Profile Picture
    61,017 Super User 2025 Season 2 on at
    Makes sense.
    It may not work for localizations that use W1 as base.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,585

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 780 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 712 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans