Let's start by establishing that some of the D365 out-of-the-box functionality can be a little clunky at times.
For 1:N relationships, when you press the "+ New" button on the sub-grid the behavior changes depending on whether the relationship is configured as either "Optional" or "Business Required". It either lets you search and add an existing record (optional) or it always makes you create a new record (business required).
This is fine. I can control that.
For N:N relationships that "+ New" button on the sub-grid only ever lets me search for an existing record. In this instance I only ever want to create a new record each time.
The scenario is relating the systemuser
entity to a custom entity (via N:N relationship) to indicate their "specialization" in a field, it's called. I have another lookup entity that indicates the field and my custom specialization entity has the following fields:
- Name (text)
- Field (lookup to the specialization field)
- Level (to gauge their degree of specialization)
If I was to reuse an existing record it would also be associated with another user's specialization. If I was to change the level of ability they have in that field it would impact any other users connected with that record.
I need to create a new record each time. If I can replace that click functionality I can just pop up a new dialog and then create the records myself.
Failing this, I need to replace the entire sub-grid control as a custom web resource, please don't make me do that!