Creating two new associated entities from one page
I have two entities Supplier and Contact with a 1 to Many association: Supplier 1 ---> M Contact I am trying to create a page for a user to create the Supplier and one initial Contact at the same time. I have tried the following three scenarios and none of them are working. 1 Supplier dataview (passed a blank Supplier via a microflow) nested inside Contact dataview (passed a blank Contact via a microflow) result: saves both Supplier and Contact record but there is no association 2 Contact listview (populated via the contact_supplier association) nested inside Supplier dataview (passed a blank Supplier via a microflow) result: Contact input fields are not displayed, says "No items found" 3 Contact dataview (passed a blank Contact via a microflow) nested inside Supplier dataview (passed a blank Supplier via a microflow) result: saves both Supplier and Contact record but there is no association Is it possible to create two new associated entities at the same time in Mendix?
Dean, here's the setup you should use:
Call this page with a microflow. In that microflow, create a Supplier and Contact, set the contact's association to the new supplier and use the Open Page activity to open your page, passing in the new Contact.
Then on the page: use a Contact dataview (passed from caller of the page). Inside that, add a nested dataview for the supplier.
Did you try to set the association between the two objects?
So create a supplier and a contact and make sure that the association is set in either the contact or supplier create action (depending on the model) and then opening the form with in this case passing the supplier.
Erwin 't Hoen
Fantastic. Thank you. It was setting the association between the two new objects in the microflow that I didn't get. Never done that before. I think that is what Erwin was getting at also and I didn't understand.