Difference between Screen action,Server action and Client action.

Hello All,

I am new to Outsystems and trying to learn Outsystems. Can you please help me in understanding the different types of actions(server, client and screen action) and when and where they are used?


Please help me with this


Solution

Hi Ankita,

A Screen Action is an Action that's local to a Screen. It can only be called by Screen Elements (in Web) like Buttons or Links, or by a Notify of a Web Block. In Mobile, Screen Actions can also call each other. Screen Actions have local scope to the Screen (outside the Screen they are not visible), and have access to all Screen Input Parameters, Screen Local Variables and Widgets. Screen Actions are run either on the server (Web) or on the device (Mobile). Use Screen Actions for simple logic that's Screen-specific.

Server Actions are Actions that are always executed on the server, both in Web and Mobile. Since Web Apps run on the server in their entirety, this is the only available type of Action for a Web App. When a Mobile App calls a Server Action, it needs to be online (since it must reach the server to execute the Action). Use Server Actions in Web Apps whenever you need to abstract some business logic or core logic or domain specific logic. Use Server Actions in Mobile Apps only if you cannot avoid it (e.g. when syncing data), as it will incur a performance penalty (for calling the server and waiting for it to respond back).

Client Actions are the Mobile equivalent to Server Actions. The run on the device, not on a server. Client Actions are therefore only available for Mobile Apps. Their use, like Server Actions, is to abstract logic.

Since OutSystems 11, there is a fourth type of Actions called Service Actions. These are very much like Server Actions, but share some properties with REST Methods (perhaps yet another type of Action), in that calling them only creates a "weak" Reference to the Module it's in (instead of the normal "strong" Reference). But if you've just started OutSystems, I'd forget about them for now.


Solution

Hi Ankita,


"A Screen Action is an Action that is called by Screen Elements, e.g. a Button or a Link (or by a Widget as part of a Notify). It has direct access to the Screen's Variables and Preperation." Note that for Web Apps, Screen Actions can't call each other, but for Mobile Apps, they can. Screen Actions have always Screen scope, so only elements of the Screen can access them.

On the other hand, Server Actions, like shoeb said, are used for encapsulating reusable logic. The can be Public, i.e. they can be Referenced by other eSpaces.

Client action use in mobile application not in web application






Screen Action: Server Action: https://success.outsystems.com/Documentation/10/Developing_an_Application/Implement_Application_Logic/Actions_in_Web_Applications

https://success.outsystems.com/Documentation/11/Developing_an_Application/Implement_Application_Logic/Actions_in_Mobile_Apps


Kind Regard

Rahul

Hi Ankita Kulkarni,

As said above, to resume:

  • Screen Action - runs screen logic, w/ access to local variables
  • Server Action - runs server logic, w/ abstract reusable logic
  • Client Action - runs client logic, can be reusable, and is reactive