You can link one account to another (self association).
On the switch button you need to log out the account A, and login the account B.
You will have to write your own login action in java, or you can use that module : https://marketplace.mendix.com/link/component/107925
But if you decide to use that module, be very careful, in my opinion the security of the domain model must be changed, and microflow need to be more restrictive (to not allow anonymous access, and not allow a user to log in as an account not linked to him).
in the domain model if the entity have the same atribute you need to differentiate each other using
to save it while you are creating an account
i hope i understand your Qs will
I can share such similar scenarios how we did this: You can decide if any one works for you
NOTE: we had specific reasons on why we had to it like this
- User A and User B are associated. We created 3 users, User Parent, User Child A and User Child B. Any modifications to user details will be done in User Parent, which will be synced to Child users
- User Child A has Admin role and can access admin module only (restricted in Mendix navigations)
- User Child B has module role and can access the specific module only (restricted in Mendix navigations)
- When User Child B, has to login to Admin module, with the existing relation, we were able to find the Child A account details, with java action we can logout for Child B and create a session for Child A so with default navigation in mendix Child A logs in to Admin module
- We had two apps (APP A and APP B)
- When user logs in to APP A and if he is admin, he can also login to APP B
- Obviously same user details must exist in both apps (Synced)
- When user clicks to navigate away from App A and login to App B
- From App A, we used URL redirector to redirect the user to APP B
- With the registered specific URL handler in App B, which triggers Microflow, we were able to get the USER ID passed, find the user and initiate a session