41
Views
17
Comments
Detach multitenant web application? Has anyone done it?
Application Type
Traditional Web

Hi,

Has anyone ever managed to successfully detached a multitenant web application?

Is this even possible?

What problems did you find?


I appreciate any comments, thanks!


Rank: #389

Hi jpaulo

Can you please explain better what do you mean by "successfully detached a multitenant web application"?

What are you trying to accomplish? 

Best Regards,
Paulo Z

Rank: #13380

After detach it is possible to continue using the multi-tenant architecture/functionalities developed in OS?

I developed a software as a Service (SaaS) applications. Each client is a tenant. 

Can i create new tenants?

mvp_badge
MVP
Rank: #51

Hi Jpaulo,

I have detached few Traditional web application successfully and made them running also , unfortunately none of them were multitenant application. But one thing I can say that the generated code is aligned to what you developed in OS like if multitenant application and it should work .


Regards,

-PJ-

Rank: #389

Yes jpaulo

You can create the tenants you want for each environment of your factory. 

You can even create a back-office application to manage all the tenants if that's the case.

Best Regards

Paulo Zacarias

Rank: #13380

No, Paulo Zacarias

I cannot create tenants. 

Its not possible to create new tenants. 

I have a back-office and it doesnt work.

Rank: #13380

The TenantCreate returns 0.

Has anyone found a way to create tenants on a detach application?

mvp_badge
MVP
Rank: #51

The back office is also the detached code ?


Rank: #13380

Yes, the back office is detached code.


The problem seems to be:

...

public static int CreateTenant(HeContext heContext, string espaceName, string tenantName) {

      // This code was unnecessary for detached source code purposes and is was removed.

     return 0;

}


How to create a tenant? Any suggestion?

Rank: #13380

Yes, the multitenancy is working for the existing tenants. The problem, for now, are the new tenants
and maintain data integrity,


Creating the tenant is more complex then inserting one line in the OSSYS_TENANT.

Tenant is used in Ossys_Tenant_View, create new views to all multitenant tables, ... I dont know at else i need to create/update.

Rank: #389

Hi jpaulo

When you say that the multitenancy is working for the existing tenants, how were these created in the first place?

To create a new tenant, you can use the System action TenantCreate

  1. This action has 2 inputs: eSpaceName (name of the UserProvider eSpace for the common cases - "Users") and TenantName (user's choice);
  2. To get the eSpaceName, you can use the action GetEffectiveUserProviderEspaceId from the Users eSpace, reference the Espace table from the System and then do a query to get the eSpaceName based on the identifier you just obtained from the action above;
  3. For the TenantName, you can call it what you want, through a text input for instance;

You might want to create a user for this newly created tenant too, with some of the basic roles. This way you will have the possibility to test if the tenant and the user is being created successfully.  

When creating the user, don't forget to pass the correct TenantId you just got from the TenantCreate action, use TenantSwitch for that. 

Best Regards, 

Paulo Zacarias

Rank: #13380

Hi Paulo Zacarias,

I am working with a detached database created in the Outsystems cloud.

The existing tenants were created in the application back office using the system action TenantCreate, before the detach.

Now, after the detach, the system action TenantCreate is not available, in Visual Studio there is no code, Outsystems removed it.


public static int CreateTenant(HeContext heContext, string espaceName, string tenantName) {

      // This code was unnecessary for detached source code purposes and is was removed.

     return 0;

}


I have a SAAS application, without TenantCreate a cant have new customers.



Thanks, best regards


Rank: #389

Hi, jpaulo

You have the permissions on your service studio dev environment to reference system actions?

Have you confirmed that this specific action isn't available to reference? 

Best Regards

Rank: #13380

Hi Paulo Zacarias,

Before the detach, the reference was available in service studio. 

After the detach, the  CreateTenant is not available in Visual Studio, the code does not exists  (service studio is not available after detach). 

Outsystems does not provide the CreateTenant reference for use after detach (the code for CreateTenant is not detached). 


Best Regards

Rank: #389

Hi jpaulo, 

You are saying that "service studio is not available after detach", may I ask you where are you doing the required changes?

Your detached application should have a development environment, or is it a matter of credentials? 

I would advise you to talk to whoever is responsible for this detached application and ask for user credentials (dev server). 

Or, if this is not applicable, open a support ticket here.


Best Regards,
Paulo Z

Rank: #13380

Hi Paulo Zacarias,

the detach process was made, the Outsystems Licence is no longer valid. The development environment of Outsystems e not available.  

The development is now made in Microsoft Visual Studio over the c# code detach from Outsystems. I have access to all credentials.

Outsystems support is no longer available.

The problem is not the way the detach was made, or permissions, the problem is that Outsystems does not allow the use of the CreateTenant action  (and others...) after detach. 

I need CreateTenant in my SaaS app to have new customers (each new customer is a new tenant). 


Thanks