How is your experience with the OutSystems Community?
4048
Views
13
Comments
Tenants
Question

Can anyone tell me about Tenant in details? What is tenant user and why we need them?


2019-09-17 09-11-00
João Pedro Abreu
Staff

A Tenant is an "instance" of your application that uses isolated data. A typical OutSystems application runs on a single tenant and the developer doesn't need to know about Tenants. You can turn on "Multi-tenant" as an eSpace property, which is especially useful if you have a Software as a Service application, although there may be some other use cases.

I'll use the company I work for as an example for multi-tenant: we sell a gym management software; each gym is a tenant; all gyms use the same application, but they can't see data from other gyms. Users are included in that isolated data I mentioned; since a user belongs to a specific tenant, when they login, they can only see that tenant's data.

What the platform does behind the scenes, for multi-tenant scenarios, is to create a Tenant _ID column in every table and then create a VIEW for each tenant, based on an SQL statement like has a "SELECT * FROM MyEntity_123 WHERE MyEntity_123.Tenant_ID = 123". These views are automatically used in queries, instead of the original tables. The platform also allows timers to be scheduled for each tenant.

2023-05-22 10-51-15
shubham mane

João Pedro Abreu wrote:

A Tenant is an "instance" of your application that uses isolated data. A typical OutSystems application runs on a single tenant and the developer doesn't need to know about Tenants. You can turn on "Multi-tenant" as an eSpace property, which is especially useful if you have a Software as a Service application, although there may be some other use cases.

I'll use the company I work for as an example for multi-tenant: we sell a gym management software; each gym is a tenant; all gyms use the same application, but they can't see data from other gyms. Users are included in that isolated data I mentioned; since a user belongs to a specific tenant, when they login, they can only see that tenant's data.

What the platform does behind the scenes, for multi-tenant scenarios, is to create a Tenant _ID column in every table and then create a VIEW for each tenant, based on an SQL statement like has a "SELECT * FROM MyEntity_123 WHERE MyEntity_123.Tenant_ID = 123". These views are automatically used in queries, instead of the original tables. The platform also allows timers to be scheduled for each tenant.

Thanks for sharing it helps me a lot.


2022-11-12 11-28-30
Gonçalo Martins
Staff

Hi Pradip.

Take a look at this page from the documentation and you'll get it.

Cheers,

GM

2018-06-21 09-31-24
Tiago Bojikian Costa Vital

Good explanation João

What happen if you start with a entity as a no multi tenant , some record are inserted and after that you change this entity to be a multi tenant ?

So the records inserted before will not be available more,  right ? 

2019-05-22 11-30-09
Marcelo Ferreira

Hi Tiago,

Those records will be on Users tenant. This is a tenant that exists by default in Outsystems.

Regards,

Marcelo

2019-09-17 09-11-00
João Pedro Abreu
Staff

If you inserted records into a table and then changed it to multitenant, the Tenant_ID columns on those records will be empty, so they won't appear in any query.

2026-06-04 12-39-36
Hans de Vries

Digging up this medium-old thread ;) 

Can anyone tell me when the Tenant-views are created? It seems not right after creating the tenants. Is it upon first 'use' of the tenant? Is it scheduled or via a process? 

Inquiring mind needs to know :-)

2024-06-19 07-19-32
JitendraYadav

Hi,


Please find below forge url to understand Tenant.

https://www.outsystems.com/forge/component/4119/multitenantapp/?Unfollow=False


Thanks!

2026-06-04 12-39-36
Hans de Vries

Hi, 

Thank you for your reply.

I know how to create and maintain tenants - our core application makes heavy use of Tenants. 

I was just wondering when the views are actually created; I found out that, after creating a new tenant the table views do not immediately exist in the database for all multi-tenant espaces with entities. So there must be some other mechanism that creates the views. I suspect it is done when calling logic that queries the database in that space, but that is just a guess. 


Hans

2023-07-28 17-00-32
Marco Arede
 
MVP

Hi,

OutSytems has great documentation! 

I would suggest you to attend to this class:

https://www.outsystems.com/learn/courses/45/master-class-on-multi-tenancy/?StartCourse=False

Regards,

UserImage.jpg
Theo van Weelie
2026-06-04 12-39-36
Hans de Vries

Hi Marco, 

Thanks. I watched the video, nothing new unfortunately. I'll do some more testing to see if I can figure out what's going on behind the scenes ;) 

2021-03-15 08-59-11
Hendrik H.C. Coops

And did you?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.