How do i do to create a CreateOrUpdateResourceWrapper?

Hi, i am having a problem with the mobile developing curse, he asks for me to put a CreateOrUpdateResourceWrapper in the loggic scope but it dont exist in my app, and he dont teach me how to create this one, i have just the createToDoWrapper and UpdateToDoWrapper, thanks in advance 


Hi Emanuel,

The wrapper here is just a Server Action created in the same module as the Entity, that will be used instead of the Entity Action.

So, in this case, it is asking you to create the referred Action and use it in the place of the CreateOrUpdateResource entity action.

You open the data module, add a new Server Action (with the name asked in the exercise), create the input parameter (Resource record data type), and an output parameter (Resource Identifier), and create the logic inside it to create or update a record using the input parameter, and return the new/update record identifier (id).

Than you make it Public, and set the entity to be Expose Read Only YES.

Publish, refresh the dependences in the consumer module and reference the new Server Action and fix the errors (the places where you were using the Entity Action that now is not available, replacing it by the new Server Action).

The idea is to have a wrapper that you can use to guarantee no bad data is inserted in the database and that anyone that wants to inser/update data in this entity will have to use your Action.

Cheers

P.S. In the case of the exercise, instead of a record it is asking you for specific input parameters that you will have to use.