I am using two server action in a client action. Why there is a warning to group them? If so, How to group multiple server actions in a screen action?
Hello Kapil,
When we are using server actions in a client action . There is a request going from browser to server. So when we are using many server action in a same client action , it causes many request to server. That can slow down performance.
So the best way is to create one wrapper action of all server action which you want to use and then use that wrapper action into the client action.
Thanks
I marked this reply as solution as it is the better explanation to why the error occurs. And how to fix it.
Thank you Daniël Kuhlmann
i believe it's more that this... not only performance... something more serious will happen
It is always better to make your action flow as small as possible. OutSystems by default throws a warning if you use more than one server action in a client action. If you consider a large amount of data and if you are exposing two server action within same client action, it will take time to process that data which is not so user friendly and not so beautiful in the sense of performance.
However, you can still include more than one server action if your application is not that big and if you think it wont affect your application's performance.
To avoid the error, you can group all the server actions in one another server action and call that server action into your client action. This way you wont get any warning.
The warning is NOT about a large action. It is about performance, each server action is a call to the server over the network. Multiple calls to the server from a client action are having s bad impact on performance.
The suggestions to not fix this is a bad advice, because it ALWAYS will impact performance. 2 server calls will always cost more time then wrapping them into 10 server action.
Hello Daniel,
I did not say anywhere that the warning comes up because of the large action. Its just the 1st line and rest is all about the performance.
I gave the solution to wrap server actions in one, and I think its the correct way of doing it?
You say it yourself, you did in the first line. You also suggest that it's OK to have multiple server actions in a client action, which it isn't. It is only OK if they are mutually exclusively called, like one server action in the False branch of an IF and the other in the True branch.
Your proposed solution is indeed correct, but the intention of the solution is to make the code more performant, not to get rid of the warning.
Anyhow, I didn't unmark your reply as a solution, I think it was the original poster. I marked your reply again as solution. It still describes a solution, I do still think that the other reply is a better described solution then yours.
Sure thing. I understand.
I wants to wrap server actions in one but I don't know how to do this can you please tell me how I can do it
Hi Rutuja,
Please find attached OML. I'm trying to explain to create wrap server actions.
Hope this will help you :)
Let me know if you need any more clarification.
Thanks,
AV