Is multi-tenancy on

  

I turned on multi-tenancy for my module.

But when I view my system entities, there is no eSpace entity, no Tenant entity, and no Tenant attribute in the Users entity.

What could be the problem?

No Bill,

No problem there. Turning on Multi-Tenancy does not need that you have those things readly accessible to you.

You can go to Manage Dependencies and in the System module those entities will be there. 

And you can check the Show Tenant Identifier in the properties of the User Entity.

But from the kind of questions that you are asking I would recommend reading this:

https://www.outsystems.com/help/ServiceStudio/9.0/Multi-tenant_eSpaces/ImplementingMulti-Tenancy.htm

https://success.outsystems.com/Support/Enterprise_Customers/Maintenance_and_Operations/How_to_Build_a_Multi-tenant_Application

https://www.outsystems.com/help/ServiceStudio/9.0/Multi-tenant_eSpaces/About_Multi-Tenancy.htm

If you have read those, could you state what you want to do with multitenancy.

Cheers,

José

Thanks, Jose.

I have already read some of the reference material you provided and watched the videos that go with it. Some were new and I have now reviewed all of them.

Also, thanks for your patience with all of us learners out here.

I am building an application called BTP. I am still in my personal space at this point in time. It has one module that holds the database, called BTP_Core. It has another module that holds screens and refers to the database, called Program_Management. There will be another screen module in the future. I want it to be multi-tenant because I will have multiple customers, each with their own data. No customer will be able to see another customer's data.

Application construction is far enough along to start demonstrating. I have loaded quite a bit of demo data. This all before I turned on multi-tenancy. The user provider was Users, the default.

-------------------  The switch to multi-tenancy  -----------------

  • I turned on multi-tenancy for both BTP_Core and Program_Management modules. 
  • All entity multi-tenancy properties were blank, so inheriting.
  • I created a second tenant (Bizoptimize).
  • I downloaded the Multitenant Management application from the Forge and explored it. I could see my original default tenant, Users, with all the users I had already created. I could see the new tenant, Bizoptimize, with no users. My user id is still listed under the Users tenant.
  • Next time I compiled and ran the Program_Management module, I was able to successfully logon but no data appears in any screen.

-------------   Troubleshooting   --------------

  • I discovered the user provider for BTP_Core was set to BTP_Core (same eSpace). I switched to Users with no change.
  • I noticed BTP_Core listed tenants as BTP_Core only. Bizoptimize was not listed as a tenant. Although, as I wrote this I looked again to confirm and the Bizoptimize tenant appeared. I don't know why.
  • I don't want to try things in ignorance for fear I will create a real mess. At this point it should be just a setting or property that needs to be corrected and I am off to the races. But I don't know what it is or how to keep from making matters worse.

Any advise on getting this setup correctly would be greatly appreciated.

Hi Bill,

José already explained how to add dependencies to the entities and attribute that were "missing"... so I'll focus on your troubleshooting.

Where did you create your Bizoptimize tenant? from the BTP_Core module's "Tenant" tab in Service Center? If you did this before changing the BTP_Core module's User Provider back to the Users espace module, that tenant was bound to the wrong User Provider (BTP_Core instead of Users). Consider creating a new tenant now and make sure there's mention of Users in the UI:

Even with a proper Tenant, remember that as part of your tenant setup process you will still need to create users in that tenant.

Thanks for joining the conversation, Jorge.

It is all becoming more fuzzy instead of more clear as I am in learning mode. The things I should know and be aware of I am not. For example, when I added the second tenant, Bizoptimize, it did not occur to me that I would have to add it to both modules. I expected to go to one place to manage tenants. I was surprised when I discovered that Bizoptimize was not a tenant for BTP_Core (the database). I was even more surprised later when it was a tenant. I do not know how that happened.

Understanding how this all works is important but still secondary. My primary objective right now is being able to see all the demo data I loaded before I turned on multi-tenancy.

All users were created before I turned on multi-tenancy, including myself (the system administrator). I created all users. I created all data while logged in as myself. After turning on multi-tenancy, I created one tenant and no users. I have verified that all users appear under the Users (default) tenant. Now when I log on as myself or any other user I see no data.

What are the possible reasons?

Thanks.

Hi Bill,

when you consume the tables from your core espace are you exposing the tenant id with the "Show Tenant Identifier" ticked on the front end espace?

If  is that the case that's why you can't see the data.

Cheers

Hi Bill,

To troubleshoot it, do this:

  • In the entity where you have some demo data double click on it and select YES in "Is Multi-tenant" and check the "Show Tenant identifier":

  • Then, create an aggregate (in some dummy action) with the a join between your entity and the Tenant entity like this:

This process, will give you the name of the tenant where your data is, so that you start to understand what happened.

Cheers,

José

Thank you so much. Very revealing and informative.

All my users belong to the tenant 'BTP_Core'. I suppose this was the default tenant for the BTP_Core module. I did change the user provider from BTP_Core to Users. I thought this was the guidance from the reference documentation and videos. But, I did this while troubleshooting. I was not seeing my data when the user provider was set to BTP_Core.

Now I have tenants as follows:

  • In BTP_Core (Database)
    • BizOptimize
    • Users
  • In Program Management (Screens)
    • Bizoptimize
    • Users

Notice that the BTP_Core tenant does not appear in either module. Is the fix changing the BTP_Core user provider back to BTP_Core? If not, how do I fix this?

Thanks.

Here is some additional information to support troubleshooting / explanation.

Hi Bill,

Since all your initial data setup was in BTP_Core, all records will have their TenantId set to the Id of the BTP_Core tenant... if you want to change that data to another tenant you will have to change the TenantId of all BTP_Core records to the Id of the Users (or maybe Bizoptimize, if that's what you wanted), and this includes things like role assignment, etc... 

Hi Bill,

As Jorge has said, you will have to change the TenantId of your records to the correct one.

But I would consider, at this point, if it would not be simpler to bootstrap/load again the data into the right tenant...

Cheers,

José

At this point I have no customer data in the database. All the data is what I put there to develop, test, and demo. I don't really care what the tenant is called. It will be the tenant I use to test and demo. What is the simplest and most immediate way to see that data in my screens module (Program_Management)? Would it be to simply change the user provider for the BTP_Core module to BTP_Core? Would I need to also change the Program_Management module user provider to BTP_Core? If I do that can I still use the OutSystems Users app to manage users or will I need to do something different? And 10 more questions...

I want to make sure I do not make a change for expedience and ruin the long-term maintainability. Where can I go to get a more in-depth education about modules, eSpaces, and tenants so I can make the right decisions?


Thanks.

Hi Bill,

I would:

Cheers,

José

All this I have done. Upon further investigation I have made a discovery that explains the problem. I just need to know how to fix it.

All of my data references the BTP_Core tenant. All my users, however, are part of the Users tenant. This would explain why no data is visible. 

How could I have data in a different tenant than the user that created the data? How can I get my data and users on the same tenant, preferably Users, but not necessarily?


Thanks.