Run Server Action

How to run Server action automatically when screen loads?

eg. 

I have a Customer screen, i made one server action named 'getcustomers' and a made a client action to call a server action.

what to do to run my client action automatically when my Customer screen loads?

you can use data action for this.

inside data action you can add a flow you implemented in getcustomers server action.

data action start its execution when screen initializes same when aggregate starts its execution.

right click on screen and there is option called "fetch data from other sources" click on that, this will create data action.

mvp_badge
MVP

Hi Dev,

You can call the GetCustomer server action inside the Data Action to fetch the required data.

Refer this docs: https://success.outsystems.com/Documentation/11/Developing_an_Application/Implement_Application_Logic/Actions_in_Reactive_Web_and_Mobile_Apps

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Interfaces/Adding_Data_and_Logic/Data_Action


Note that the Data Actions run simultaneously with the client and server Aggregates to fetch data after Screen loads. 


I hope this helps you!

Kind regards,

Benjith Sam

mvp_badge
MVP

It is against best practices to isolate data retrieval in a separate server action. Outsystems Will not be able to optimize the query. Use fetch from database or data action.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.