Show different homescreens after login for different user roles
Application Type

Hello everyone,

I'm quite new to outsystems so I have a question for you.

I defined two different roles in my application. I've already created different screens for them because they don't have the same layout and permissions (it's like an employee and customer view).

The use case should be that the user is directed to the suitable homescreen directly after the login (based on the user role). Is it possible to show the different screens depending on the user role? Maybe I have to integrate it to the Login Action?

Thank you in advance :)

Rank: #55

Hi Leonie,

In your Login screen, you have a screen action with the logic for when the user presses the Login button:

This is the logic that needs to be changed to check the user role and to redirect to the screen accordingly.

After the DoLogin action, you can check if the logged-in user has a given role with a simple Javascript. In the example below, I want to check if the user has the Admin role, so I add the Javascript widget with an output parameter IsAdmin.

You should replace the $roles.Admin for $roles.<Your Role>.

And then a simple If using the output of the javascript to redirect to the right screen if he has the role or not.

Hope it helps.


Rank: #55551

Hi João,

first of all thank you for your suggestions. I understand how it is going to work. But I have a problem with the javascript. As you can see in the Screenshot I get an error message. Do I have to define the output parameter in advance or just in the javascript? Do you maybe know where my fault is?


Rank: #55

Hi Leonie,

You're welcome, I'm glad to help.

Inside the JavaScript window, you should right click the folder parameters, and choose the option add Output Parameter and name the Parameter IsBank_intern.

You should then use that Parameter in the if afterwards.



Rank: #55551

Thank you very much. Now it works!

Best regards


Rank: #515

Hi, Leoni.

I have done some tests and I think that it is possible to do what you want by changing the Common/Login/Login Run Server Action. After User_Login action, you will need to check if the user has the apropriate Role and then go to the Role-URL.

It could be done by using IF statements after the User_Login Action using the Check<Role>Role() action provided by each role.

Rank: #55551

Thank you for your reply. I've already solved my problem with Joãos help :)

Best regards