How do I separate the two users (doctor and patient) in the login and homepage after

i have two users in the same application that i create but they have different pages after logging in

How can I do this with outsystem?

How does the system identify each user by identity?

for more information

our users are patient and psychiatrist so we want them have different home page when they login, I will appreciate your help!

the pictures below, describes that either you are a psychiatrist or patient in both pictures after the if condition the page that will appear is the one which have the fales value .

regards,

If you give the roles to the users that will be more used full for give
Create two roles and pass that role to the respective users
and on the login page write if condition to check role if role is patient then redirect to patient or redirect to doctor

Documentation of how to create role:   https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application/User_Roles/Create_and_Use_Roles

Same question with solution : https://www.outsystems.com/forums/discussion/67657/show-different-homescreens-after-login-for-different-user-roles/ 

and here is the same question on the bases of role how to navigate to different screen is here(that is traditional one but logic is same )
https://www.outsystems.com/forums/discussion/47669/how-to-redirect-users-admin-to-their-specific-homepage/



In your above case client variable will not be used

second approach that is not flexible but if you have only two users
ex, ABC= patient DEF=doctor
then in the login page check the username in the if condition
client.Username=ABC then redirect to patient if not then to doc. (this is not much flexible only for two users i am suggested this )

Thanks and Regards,

Akshay Deshpande


this is what i did have put roles ,but when i check in the if condition for patient  it will go to the doctor as u can see in the screen shots . and in the other example i have checked two times one for patient one for doctor and as you see in the screen shots above its also go for the false value in the if condition twice    

it went to the home page 

Hello ,

In the If condition you are checking wrong condition after your check role action in the if condition the the output of that client action (which gives you true or false value )

In the if condition change the condition with the client.something will not give the output after client action that action passes true and false value in role is expected then true else false put that condition so 

You will get desired output. like this

Thanks and regards,

Akshay Deshpande

this is what i get when i do it and even if i login with doctor or patient this error message will appear

Screenshot (265).png

Can you paste the screenshot of the roles (logic tab downside )(expected two roles in that)
and the server action in you used the check role action
Expected steps : all in logic tab only (Already @Pavan Rajapurkar share the OML of it)

Not defined give if you not give roles in that roles or not created roles in OutSystems

Thanks and Regards,

Akshay Deshpande

I think you missed the third step

One output parameter need and it's wrapper to the your role(server) action check in the image that i give and code in the pavan rajapurkar OML

Hello,

Instead of client variable you can create a role and check it in the login action and accordingly you can redirect the user to a specific screen. 

Please go through the OML for better understanding. Hope it helps you.

URL : https://pavan-rajapurkar.outsystemscloud.com/HomepageSample/Login

Login credentials:

Admin login: Username:- ITAdmin Password:- ITAdmin 

Customer Login: Username:- Customer, Password:- Customer

Regards,

Pavan R

HomepageSample.oml

i did the same and this message error appear after i login

for both users username

Screenshot (265).png


Hello,

 I think this issue is of client variable or you have not set the role to a particular user. Please go to /users and check if that user has the particular role or not. Something like this:-


  Please go through my code once and implement the same if still error occurs then is  it possible to share the OML? for better understanding.

Regards,

Pavan R

Hello please do the following changes:-

1) In the patient screen you have given a screen access to Psychiatrist user so give it to patientAccess. Check the same for every screen and check the checkbox accordingly.

2)    You don't need this action you have already implemented it above so delete it.


3)  You should check the output parameter of checkRole action not the client variable. So modify it

 


PS: Do the same for Psychiatrist role.

I have attached the updated OML please go through it.

Hope it helps you.

Regards,

Pavan R


Front.oml

look after running your oml after i login its directly go to homepage not the patient page so i changed the logic and deleted the second if condition for the doctor to this 

and after i log in with username :aziz,password :1234 which is patient  account i have this 

so , what should i do to login with patient account  to go to patient page and t login with doctor account  to go to 

Psychiathirsts page 
this is my flow of pages :
1 - interface page so any user even who do not have account can brwoes the website and if he click any session he will will have to signup or login after that will come the second page ,
2- login page that contain the signup buttons also, then after the user login there 
will be the two pages patient/doctor which we have the problem. then i will added the
pages for each users

Hello,

This issue occurs only when the user don’t have a permission to access a particular screen so please make sure that user- aziz has patient role or not. You can check this from your environment URL/Users.

Regards,

Pavan R

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