Reactive: Redirect users to different screens without having performance issues?

Hello! I just started working in Reactive and i'm trying to redirect users to different screens based on Roles...I tried to use the "On Initialize" action to check admin role and redirect, however, the check role function can only be used through server actions and these ones provoque performance issues if used in any of these screen events (or at least I get a warning about it...).

Do you know of a better way to redirect without using these screen actions ou without using server actions?


Thank you

Eluisa

Hello Eluisa.

My advice for Mobile would be for you to do it in Splash Screen.

In Reactive, you don't have that "loading" concept, but you do have an Entry Page. I would call the server action on that one, and save in client variables for later reuse if necessary. Roles are a key component of OS screens so there is no risk of accessing the wrong page, just not going to the right one.

You can call it OnRender as long as the page has something to "entertain" the user (a Loading Screen).


Hi Eluisa,

As Nuno mentioned you can do it in the splash screen, alternative you can code it in the OnInitialize event handler of the main screen. This screen would not have any content and only the role-based orchestrator. 

Regards,

Daniel

Solution

Hi Eluisa Fonseca,

the check role function can only be used through server actions and these ones provoque performance issues if used in any of these screen events (or at least I get a warning about it...).

In addition to the previous comments from Experts, I just want to include one more statement that is, you can also validate the End-User role in the client side using the OutSystems JavaScript API


Refer this forum post:  https://www.outsystems.com/forums/discussion/55602/how-to-check-role/#Post209200

Please make a note of @Kilian Hekhuis comment mentioned in the above shared post link


Regards,

Benjith Sam

Solution

Every situation is different.

For your purpose Eluisa, Benjith solution is simpler.

Note that both the Javascript - and my client variables - approach are not completely secure. You must use Server Actions to be sure.

Good morning! I tried the JS solution and it worked perfectly! Thank you very much

Nuno Reis wrote:

Every situation is different.

For your purpose Eluisa, Benjith solution is simpler.

Note that both the Javascript - and my client variables - approach are not completely secure. You must use Server Actions to be sure.

But the problem was when I made the check using a server action I got a performance warning. So if I want to be sure (security wise) I will always have to compromise performance and use a server action (in adition to a JS or client variables approach?


You can call OnRender and there will be no warning.

Obviously, connecting to the server affects performance, but that is the price of having security. Keep in mind that this is just needed once. So performance is not that affected.