Skip to main content

Notifications

Announcements

No record found.

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
 
  • Mohana Yadav Profile Picture
    Mohana Yadav 60,161 Super User 2025 Season 1 on at
    Check Environment Country
    Makes sense.
    It may not work for localizations that use W1 as base.
  • AJ-05070558-0 Profile Picture
    AJ-05070558-0 25 on at
    Check Environment Country
    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
     
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 78,034 Super User 2025 Season 1 on at
    Check Environment Country
    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
  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 60,161 Super User 2025 Season 1 on at
    Check Environment Country
    Or 
    Simply use below code
    Message(CopyStr(ApplicationSystemConstants.ApplicationVersion(), 1, 2));
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 78,034 Super User 2025 Season 1 on at
    Check Environment Country
    Yes, this is much simpler than using OAuth authentication to get the standard API.
  • AJ-05070558-0 Profile Picture
    AJ-05070558-0 25 on at
    Check Environment Country
    Thank you YUN ZHU, quite impressed with your blogs
    I have used your IP address blog
     
     
  • YUN ZHU Profile Picture
    YUN ZHU 78,034 Super User 2025 Season 1 on at
    Check Environment Country
    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
  • Ajay Jain Profile Picture
    Ajay Jain 213 on at
    Check Environment Country
    Thanks for quick answer
     
    I need something to write in codeunit without calling api
     
    I think I just need country code
  • gdrenteria Profile Picture
    gdrenteria 14,573 Most Valuable Professional on at
    Check Environment Country
    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

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

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans