Use the OnSessionStart action to handle the System event that occurs in the following situations:
After an end-user logs in to the application;
On the first request after an end-user logs out of the application.
As an example, you can design this action to prepare session variables of the eSpace after an end-user logs in to the application.
You're allowed to design the OnSessionStart action in any eSpace of your application and this way handle this System event in the context of each eSpace. The OnSessionStart action is executed once an element of the eSpace is used by the application: a web screen, an action, etc. If there's no usage this action is not executed.
The OnSessionStart action has no input parameters nor output parameters but you can create local variables.
There are a couple of remarks to be made regarding the OnSessionStart action:
In a Single Sign-On scenario the session is shared among all of the unified eSpaces: the User Provider eSpace and User Subscriber eSpaces. In this case, the OnSessionStart action of the User Provider eSpace is executed before executing the OnSessionStart action of a User Subscriber eSpace.
If you're using Persistent Login and an end-user is implicitly logged in to the application, the UserId and the persistent Roles for that end-user are already loaded when the OnSessionStart action is executed.
About Requests | About Sessions in OutSystems Platform | Single Sign-On | Persistent Login | Overview of System Events