You need multiple – multiple associations. Because a contactperson can have multiple events where the person is attending and an event has multiple contactpersons. But if I where you I would change the names a bit because that makes it less confusing I think. Let's say we have Events. Events have a host and attendents. The host is the one who can add attendants to an event. Now all attendants and host all are an Person object and all Persons have an account.
So it would look like this:
The multiple – multiple reference refer to each other so that when you have an event you could retrieve all the attendants and for each Person you can retrieve all the events. So when a person creates an event he becomes the host of that event. Each event can only have one host. This way you can achieve that only hosts can add attendants for their own events. Does this helps a bit?
Regards,
Ronald
To achieve this create the following domain model:
Make sure the association between Event and ContactPerson is *:* and the association is set to let both entities refer to each other (double click the association to change this option).
On the account page create a datagrid to add new contact persons(via association), make sure to delete the reference selector for the account on the NewEdit page of the ContactPerson (this is automatically added when generating the page).
Now you can add as many contacts to an account as needed.
Also create a datagrid for the Events in the same way as for the contacts.
On the Event_NewEdit page remove the reference selector for the account (if generated) and add a reference set selector widget where you select the ContactPerson entity over the many to many association:
Generate the select page by right clicking the add button and now for the part to restrict the selection of the Contactpersons to those that are associated with the Account. In the properties of the reference set selector there is an option called constraint by:
Press the Edit button and select the option available:
Now the selectable contacts in the select page are constraint by the selected path over the account entity. The constraint needs to be set on the reference set selector and not the select page itself!
The same result can be achieved by using the xpath option in the selectable object properties.
Hope this helps you to achieve the desired result