Database.TenantId() Method

Version: Available or changed with runtime version 1.0.

Gets the ID of the tenant that has started the current session. Use this method when your code must be specific about which tenant database to access in a multitenant deployment. For example, if your code imports data into a cache, you can make a cache tenant-specific by using the tenant ID as a key. Also, if you want to write code that saves documents, you can include the tenant ID in the file name or location, for example. In those cases, you can use the TENANTID method in combination with the COMPANYNAME method to identify the company and the tenant database.

Syntax

ID :=   Database.TenantId()

Note

This method can be invoked without specifying the data type name.

Return Value

ID
 Type: Text
The ID of the tenant that has started the current session.

See Also

Database Data Type
Get Started with AL
Developing Extensions