35
Views
5
Comments
Change tenant is not keep in Reactive application

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?

Rank: #89

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

Rank: #3650

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.


mvp_badge
MVP
Rank: #78

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

Rank: #171

Hi Enrique,

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.

Rank: #8098

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.