Best practices for CRUD actions in Mendix

0
Dear community,   I am relatively new to Mendix and busy transitioning from OutSystems (OS). MX is fabulous I must say!   Best practice in OS would be to create reusable CRUD actions for each entity. Normally this would involve two main actions for each etity: "CreateOrUpdate_<Entity_Name>" and "Delete_<Entity_Name>".    I am inclined to follow the same approach in Mendix, as I would want to call these CRUD actions as Subflows in any other Microflow where required.   Is this a good approach in Mendix? What would normally be best practice for entity CRUD actions in MX? Any advice on things like error handing and security in standard, reusable entity CRUD actions? When is it good to use cascade deletes in data-model, and when should one rather use delete actions in Microflows?   Thanks!!  
asked
3 answers
0

Hi and welcome Leon,

A lot of projects do use subflows for crud actions, and while it's not listed as a best practice in the docs, from a security and maintainability perspective it should be. Using a sub for commit, get create and delete actions has many advantages but the drawback is that project members often don't have the discipline to consistently use them. Several times I've seen projects run into trouble for not using crud flows, especially the larger ones.

answered
0

Several questions in one, so I am going to pick just the one about cascade delete. Obvious answer is: Depends on your requirements...

Using a microflow you have more control over what you are doing and maybe create additional logic in stead of automatically executing the cascade delete. Furthermore when using cascade delete, you will have to make sure that the person deleting the main object also has the credentials to delete the associated object, otherwise you will get a generic error. In a microflow you can add custom error handling

answered
0

Thanks for your answers Lenart and Micah!

Much appreciated :)

answered