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?
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.