Hi,


If I understood correctly,

If I define a client action A as a function, then it wont be able to call other client actions. Also it wouldnt be able to call other server actions as well?

However for server actions set as functions then can call other server actions?

Hi Nishit,

Hope you're doing well.

So here's the deal:

  • Client actions can call other client actions
  • Server actions can call other server actions
  • Client actions can call server actions
  • Server actions cannot call client actions

This is the generic picture.


A function (no matter if it is a client or a server function) is still an action.

The reason to use a function is to enable the action to be used in expressions. When doing so, a single output is mandatory.

Functions and Actions are basically the same thing, there are no performance advantages when using one or another. The main difference between them is that a function can be used inside expressions directly on the screen, while an action can't. But you can still use a function as a regular action in your flows, because a function is still an action.


Hope this helps you!


Kind regards,

Rui Barradas

Thanks Rui for your reply.


But I was checking in reactive web development. I saw that a client action defined as function can only call other client actions if those are also defined as function.

Client actions defined as function cannot call a server action. It throws an error.


I found the behavior bit strange but that is how it works i guess 

In addition to Rui's answer, when a Client Action is a Function, it can only call Client Actions that are also Functions. It cannot call non-Function Client Actions, and it cannot call Server Actions. The reasons for this are of a technical nature.

Nishit Sadual wrote:

Thanks Rui for your reply.


But I was checking in reactive web development. I saw that a client action defined as function can only call other client actions if those are also defined as function.

Client actions defined as function cannot call a server action. It throws an error.


I found the behavior bit strange but that is how it works i guess 

Hello again Nishit,

That's also correct.

A client action defined as a function can only call other client actions defined as functions. In this particular case, you won't be able to call client actions that are not functions neither server actions.


Kind regards,

Rui Barradas

Thanks Killian and Rui

You're most welcome!

You're welcome Nishit, we're glad to help.

@Kilian, thank you for the additional information over my answer.


Kind regards,

Rui Barradas

Solution

Hi,

You have two questions I believe:

1. If I define a client action A as a function, then it wont be able to call other client actions. Also it wouldnt be able to call other server actions as well?

This answered by Kilian:
A client action defined as a function can only call other client actions defined as functions. In this particular case, you won't be able to call client actions that are not functions neither server actions.

The reason a client action defined as function cannot call another client action or server action is that the call of that client action will not be synchronize, as it can be used in expressions on your screens and blocs. A client action not defined as function will be called async.

2. However for server actions set as functions then can call other server actions?

The answer is yes, Server actions defined as function can call server action not set as function. And server actions not defined as function call also call server actions that are defined as functions.

Regards,

Daniel

Solution