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 :
Business Central forum

Extracting the tenant ID

(0) ShareShare
ReportReport
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:
I have the same question (0)
  • Suggested answer
    jdecottignies Profile Picture
    217 on at

    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 > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans