Skip to main content

Notifications

Announcements

No record found.

Business Central forum

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.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans