Tenant switch logic without updating Users Entity
Application Type
Reactive

Hi Community,

I have implemented Tenant switch logic by updating Users Entity's tenant identifier, then Tenant Switch() and finally Login(). I heard that we can implement the tenant switch logic without updating User entity. Can some one share me the logic to switch the tenant without impacting Users entity?

sharing solution oml will be appreciated.

Thanks, Aadhavan S

mvp_badge
MVP

Hi,

Why do you update the TenantId on the user?

Normally you would define Users per tenant, not changing the tenant is of the user.

Regards,

Daniek

Hi Daniel,

I tried to implement, but no luck. Share me the correct logic to switch the tenant.

No Daniel. 

My question is to understand the correct logic for switching tenant without updating tenant identifier in Users entity. Can you create a logic and share me the screenshot?

mvp_badge
MVP

Just drop the TenantSwitch Action in your logic flow, not sure what you want me to do here, what isssue do you have making it work. Should be something like this:


There is also multiple example Apps in the Forge that you can install and inspect how it is done:
https://www.outsystems.com/forge/list?q=tenant&t=&o=most-popular&tr=False&oss=False&c=%20&a=&v=&hd=False&tn=&scat=forge

in the same logic, User_Login action requires again username and password. Do we need the user to navigate to login screen when switching tenant?

As per my understanding, User should be routed to another tenant without entering credentials again.

Correct me if I mistaken

Thanks, Aadhavan S

mvp_badge
MVP

Then use the Login action which only requires a UserId.

Hi Daniel,

PFB screenshot, in User_Login Action, both username and password are mandatory

Thanks, Aadhavan S

mvp_badge
MVP

Read my last reply again!, I wrote use Login instead of User_Login. The Login action only requires UserId

Need a bit more information on exactly what you are trying to do. The main issue is that each user is specifically linked to an individual tenant so changing the tenant means you also have to use a different user that belongs to that tenant.

You can issue a TenantSwitch however as the user exists against the old tenant you will then effectively be unauthorised. You can use the Login function from within System that accepts just a user ID (Not the User_login or LoginPassword actions) however that will have the wrong tenant ID so won't work for you. 

Depending on what you are actually trying to achieve you may need to create multiple users in each tenant by the same name, change tenants, search for the user, get it's ID, then use the Login function to login as that user without the password. 

But having to do this implies that you aren't using the multi tenant functions they way they are intended. The idea of having multi tenants is to completely separate different users or "clients" so having one user jumping between tenants doesn't work very well, particularly as the users roles and security have to be redefined in each tenant.

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