Ownership Issue in One to Many Association / Create-View Object From Non Owner Entity

Hi all, I need some help in One to Many Association in Mendix. Scenario:      I have 2 Entities Library and Book, Each Library can have multiple Book  (One to Many Association).                        In the above case One to Many Association, Owner of Association is Book Entity (I Cannot change owner of association to Library). My Problem is:   1-    How do I add books while creating a new Library Object (Non-Owner), I want to Select list of books (Owner) in New Edit Page of Library Entity (Non Owner). ??   2-    How do I show list of books available in Library object in Overview Page of Library Entity (Non-Owner). ??   Thanks Dherendra        
2 answers

Try something like this. In order to achieve what you want, Library has to be the owner of the association



Hi Dheerandra,

We should put some custom flow to achieve your use case.
In the Library New/Edit Page Add a button Say it AddBooks and then call a microflow (Act_Library_SelectBook)which will a call a new page with a dataview in iit and Library  context object.say it as Book_Select.
Now in the Act_Library_SelectBook place a show page activity and call Book_Select page.  Inside the Dataview add a Data Grid with Xpath and context object as Book. In the data Grid Add a Action Button and call a microflow and name it as Act_AddBook_Library. Now the Act_AddBook_Library will have two paramter Library and Book.  Put a Change object actvity and map Book Entity. Now in the Association add the Library object and select refresh in client check box and then put a close Page Activity. This will work as you mentioned.

In order to verify in the Library New/Edit page add a DataDrid below the Add button and select Asociation as datsource and Show Book Details. 


Add a closepage activity after the Change object.



Let me know if it work for you ATB !!