If you ever wanted to have your own multiselect optionset which would be utilizing an N:N relationship behind the scene, here you go:
It works and behaves similarly to the out-of-the-box multiselect optionset, but it’s not an option set. It’s a custom PCF control that’s relying on the N:N relationship to display those dropdown values and to store the selections.
The sources (and the solution file) are on github: https://github.com/ashlega/ITAintBoring.PCFControls
This is the first version, so it might not be “final”, but, so far, here is how this control is supposed to be configured:
Linked Entity Name: “another” side of the N:N
Linked Entity Name Attribute: usually, it would be “name” attribute of the linked entity
Linked Entity ID Attribute: and this is the “Id” attribute
Relationship Name: this is the name of the N:N relationship (from the N:N properties page)
Relationship Entity Name: this is the name of the N:N relationship entity name (from the N:N properties page)
Some of those properties could probably be retrieved through the metadata requests, but, for now, you’ll just need to set them manually when configuring the control.
PS. There is more to it now (Jan 31): https://www.itaintboring.com/dynamics-crm/nn-lookup-on-the-new-record-form-lets-do-it/