How is your experience with the OutSystems Community?
10
Views
5
Comments
Solved
Access page using roles
Question

Hi all,

I have scenario, i have dashboard page (default page) when login as admin dashboard page appear, when login as user, diffrent page show. how i want to make since the already set the default page. on dashboard page, i already uncheck role for user unauthorized page appear.

2025-09-25 14-38-22
Lokesh Kumar Yadav
Solution

The issue happens because your Dashboard is set as the default page but is restricted to Admin only, so normal users see the Unauthorized page. Instead, create a common default page (like a redirect page) without any role restriction. In its logic, check the user role—if Admin, navigate to Dashboard; otherwise, navigate to the User page. This way, users are redirected correctly based on their role

UserImage.jpg
wan mohd shariffuddin

It's working now. Thank you

2023-09-06 07-26-35
Sudip Pal
Solution

Hey ,

To encounter this problem, you need to check role in onInitialize of your default page. But I know that you are facing problem to checkRole in onInitialize. To resolve this OutSystems has some functions inside Javascript.

In the above I have used Javascript to check the role and based on the role I am redirecting the Logged In User. Inside Javascript I wrote the below

This is how you can do the redirecting based on N number of users. But still there is some scope to optimize this.
This solution will work for your case. Let me know if you face any issues.


Thanks,

Sudip

UserImage.jpg
wan mohd shariffuddin

nice solution, i just want to know, why you use javacript instead of if statement?

2023-09-06 07-26-35
Sudip Pal
2025-09-25 14-38-22
Lokesh Kumar Yadav
Solution

The issue happens because your Dashboard is set as the default page but is restricted to Admin only, so normal users see the Unauthorized page. Instead, create a common default page (like a redirect page) without any role restriction. In its logic, check the user role—if Admin, navigate to Dashboard; otherwise, navigate to the User page. This way, users are redirected correctly based on their role

UserImage.jpg
wan mohd shariffuddin

It's working now. Thank you

2023-09-06 07-26-35
Sudip Pal
Solution

Hey ,

To encounter this problem, you need to check role in onInitialize of your default page. But I know that you are facing problem to checkRole in onInitialize. To resolve this OutSystems has some functions inside Javascript.

In the above I have used Javascript to check the role and based on the role I am redirecting the Logged In User. Inside Javascript I wrote the below

This is how you can do the redirecting based on N number of users. But still there is some scope to optimize this.
This solution will work for your case. Let me know if you face any issues.


Thanks,

Sudip

UserImage.jpg
wan mohd shariffuddin

nice solution, i just want to know, why you use javacript instead of if statement?

2023-09-06 07-26-35
Sudip Pal
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.