Commit object doesnt commit referenced objects

0
I have a FORM entity and a SECTION entity with a 1-to-many association. 1 form has multiple sections, each section with different numerical attributes values.   If I have a SAVE button on the form that calls a Microflow and I COMMIT the FORM object, is there any way to have it auto commit any referenced objects? Right now if I commit only the FORM, the SECTION values all reset to 0. I was hoping that It would auto commit these values.    I *COULD* retrieve all the sections and do a loop and commit each one, but I’m trying to limit my database calls…. not just limiting commits, but any time I have to do an extra RETRIEVE to get all the referenced SECTIONS.. that’s another database call. 
asked
2 answers
0

The default save button on a page will commit all entities on the page. If you have your own microflow performing the Save (commits) you need to commit all related entities (you wish to save) yourself.

So: retrieve by association (not via database) the associated objects, commit the lists (don't loop and commit in loop, this will be bad for performance).

Mendix will optimized the network calls. Since the objects are already part of the client state they will be sent to the server when executing the microflow. And the microflow actions (retrieve by assocation) won't need to access the database for those objects.

 

answered
0

Well , if you find Microflows tricky to commit the objects

You can Nest all the things you want and just place “Save Changes” Button on the innermost Data view . This will automatically commit associated objects with the outmost Data view 

answered