OutSystems CRUD Wrapper Checklist
2 min readOct 1, 2019
When building CRUD wrappers in your OutSystems project, there are a number of things you will always need to ask yourself along the way to make sure that they are built properly. Here is a checklist of items in the CRUD wrapper building process:
- Do we need to remove child records when deleting the parent record? If so, we need to find those child records in the GetCanRemove action, and call their GetCanRemove actions, and if there are any failures, add them to our messages list. We will also need to validate that we have no messages accumulated, and if we do, combine them into one and set our IsSuccess to false. In addition, we will need to query the child records in the Remove action, and call their Remove as well, and fail on any child record failures (throw an Exception to ensure a rollback and halt execution).
- Do we need to use a hard delete or soft delete? This will impact the XYZ_Remove Action. We will also want to remove the IsActive Attribute from the Entity.
- What additional Attributes are needed? Add them to the data model. Are they mandatory? Add a check to them in the validation area of the Upsert. Should they have default values if blank or null or zero? Add code to set default values after the validations.
- Should removing, creating, or updating this record trigger other logic to run as well (such as updating calculated fields in parents)? Put code in for it after the remove, create, or update, but before the Entity Action Result is set. I prefer, in that logic, to use an UpdateXYZ, rather than XYZ_Upsert, to deliberately skip the UpdatedOn/UpdatedByUserId logic, since the user did not explicitly save. Your needs may be different.
- If we are using a hard delete pattern, what do we do with child records, especially if they use a soft delete pattern?
J.Ja