Difference between the entty actions and server actions

Difference between the entty actions and server actions



I would like to know the difference between the entity (CRUD operation)actions when created by expose to read only NO and CRUD operations created in parent module using server actions and placing them in child module when  expose to read only YES in parent module. Please help me.

Hello Kuruma

The Entity actions perform a straight forward action without custom validation. For example the CreateOrUpdate<Entity> Entity Action will create a record on Entity A, or update the record if it already exists, and will check if mandatory fields are filled. If not, it throws an error.

Server actions are used to enable the CRUD actions to be used on child modules when the Entity has the expose read only property set to Yes. Most of the times, the server actions are no more than an action with the CRUD action being called on the flow.

You may also consider using these server actions instead of the Entity Actions so you can encapsulate reusable logic on a single action, making it a lot easier to change your logic when need be



Thanks Angelo & Formiga for giving the information......

Hi Kuruma,

The recommendation of exposing the CUD actions (create, Update and Delete) actionstrough data wrappers is akin to the Public and private methods in otherprogramming languages.

Imagine a scenario where every time you write to a specific entity you need toguarantee that the user that updated that record as well as when it was updatedis written also in the record. If you let your developers have direct access tothe actions to create or update the record, some may fill in those fields,others may forget and you lose data integrity. Another scenario is that inorder to write into a specific record some business validations need to bechecked or even other records like history need to be created whenever anupdate is made to a record. As before, if you let developers have access to thedirect create or update actions, they may forget to validate the business rulesor create the necessary auxiliary records.

Encapsulating the CUD actions into wrapper actions gives you the control thatevery write, update and delete follow the business rules you set up in thewrapper actions. This as also benefits in the long run, if you have a newrequirement in the future to do an extra validation before saving to a recordyou can do it a single place (the wrapper action) and the change is replicatedthroughout your application.

Hope this helps you.

Thanks and Regards,

Suraj Borade