Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

Extracting the tenant ID

Posted on by 5

We have written an extension for Appsource that uses  javascript to read the tenant ID and company from the URL and passes those values to our app  (which is displayed in an iframe).  

This doesn't always work though in all scenarios. Business Central offers multiple login paths. Some of these paths don't display a tenant ID in the URL, which causes an error in our app. 

Is there a more reliable way to get the tenant ID using javascript than reading it from the URL? 

Categories:
  • Suggested answer
    jdecottignies Profile Picture
    jdecottignies 217 on at
    RE: Extracting the tenant ID

    Hi,

    You can directly call in an AL file TenantId() which returns a string containing the current tenantId.

    Or you could use the "Tenant Management" Codeunit which gives your more functions to get informations about the tenant.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,252 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,089 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans