Hello Niharika,
Selecting the roles should not be allowed to an anonymous user, it would be a gap in the security.
In my opinion you could let the user to login first and only after that you should show them a page where they could select the role.
Hope this helps!
BR,
Inês
I agree with Ines that showing the selection on the login page is not allowed because anonymous users should not see the roles.
Mendix has no simple solutions for dynamic role switching. A user can have multiple roles, but that doesn't mean one is on or off at a certain moment.
First I would argue against the principle of 'role switching' in your UX. Why would you let the user switch roles? Can you not achieve the same functionality by showing the user 2 buttons that access different 'domains' in your application?
However, if you want to build something like this, you can interfere while the user logs in. Mendix will always redirect the user to the 'homepage' that you have specified in the navigation of the project (or the specific role-based homepage). Create a homepage on which you show this dropdown with the UserRoles of the CurrentUser.
One thing to be aware of is how the user can 'attach' the lost role again. Does the user has the permissions to add the lost role again to her user account?
Well, hope this helps.
If a person login for eg Niharika who has 2 role i.e BU_Head and SalesPerson_Master after login i have to select particular role so on select of role the page should be accessible to Niharika