When in my reactive application I change the tenant in the event OnAppicationReady in a server action the tenant is changed. But when OnApplicationReady is finished is reset to the default tenant.
Someone can know why?
Hi Enrique Galán ,
when you use tenant switch action it change tenant but you need to confirm on which tenant your application running.
Default tenant is - Users
also you have site property TenantID and TenantName which return current tenant.
Also you can use this site property,
Hope this will help you.
Regards
Rahul
Hello Rahul, thank you for your response.
Yes, I am using this site property and the tenant is change in the serve action
But when I debug the next server action the tenant is reset to the default tenant.
Hi Enrique,
Could you please try by defining the invalidate server action node i.e. either the "EspaceInvalidateCache" or the "TenantInvalidateCache" (available in the System Module) after the "TenatSwitch" server action call in the respective OnAppicationReady action flow
Please refer the below mentioned document link as well:
https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/System_Actions#EspaceInvalidateCache
https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/System_Actions#TenantInvalidateCache
Hope this helps you!
Kind regards,
Benjith Sam
Maybe the OnApplicationReady is not the better place to use a TenantSwitch action. Since it is a Client Action, what can be happening is that it is loading the Module before doing the first permissions check and initiating your session.Not sure if this action runs before or after your server session is initiated.
But if it happens before, when your session initiates there is a risk that you go to you default tenant again.
If possible try to place the switch tenant action in your login logic.
Hello,
In a multitenant reactive web application, we have public content to show for unregistered (anonymous) users in almost all sections. Trying to make a tenantswitch at the begining (OnApplicationStart, Home page initialization, ... tried different ways) we find that in every server call the tenant is set again as the default one. What is the better approach for having a persistent tenant switch in this case where the users are not logged? right now we have to set the tenant in every server action that deals with multitenant information when the user is not logged.
The big issue is that multitenancy is not support for anonymous users in reactive but only for logged in users.In tranditional you can do a TenantSwitch (for example in the preparation of a screen based on something in the URL) and from than moment the tenant is set will be the active tenant for the session of the user.Althought the action is still there in reactive it doesn't work. You have to do a TenantSwitch before every server actions. Then tenant is ignored in aggregates etc, etc. Me - and several other MVP's have given use cases to OutSystems why this should also work for reactive. Imagine a marketplace on internet for different countries = different tenants. People don't want to make an account first and login to see the products for a specific tenant. They want to see the products first and only make an account when they actually want to buy something.OutSystems tell this is how multitenancy works, only for logged in users and I am lucky it works for anonymous users in trandional. So please be aware of this. You have to do a lot tricks and extra coding to support anonymous users.