When designing your screens, you can create an action that is executed before the screen is rendered. This action is called the Screen Preparation.

Typically, this action includes setting values to variables and fetching data from the database, i.e., all the logic executed before the screen is displayed.

How to Create a Screen Preparation

  1. In the eSpace tree, under the Logic layer, right-click on the screen and select Add Screen Preparation;
  2. OutSystems Platform automatically opens the action flow on the Content Canvas. Design the behavior of the screen preparation.

Flow of the Screen Preparation

The Screen Preparation is designed with the Action Flow editor by simply dragging tools from the Action Flow Toolbox into the action flow.

Flow of the Preparation for Web Screens and Email Screens

In Web Screens, the Screen Preparation is executed in one of two situations:

In case a screen is redrawn, there may be some logic that does not need to be re-executed (like queries) because elements in the scope keep their values. In this case use the IsLoadingScreen built-in function to only execute the logic that is really necessary for redrawing.

This section does not apply to SMS screens as they are always loaded.

In most cases, the screen preparation action flow has only one End element, but there may be more than one End element.

In case you want to redirect to a different screen, use the Destination element instead of the End element.

Scope of the Screen Preparation

When editing expressions in the flow of a screen preparation, the following elements are in the scope:

The elements that are in scope are listed in the Scope Tree of the Expression Editor or in the Variables Tree of the Select Variable window.

Execution of the Screen Preparation

The Screen Preparation is automatically executed before the screen is rendered. Therefore, you don't have to explicitly invoke it.

However, the Screen Preparation may have a different behavior if you are using Ajax to refresh parts of the Screen.

In this case, if the Screen Action to refresh parts of the Screen ends with an End element:

See Also

About Actions | Create a Screen Action | Action Flow Editor