Is it a multiselect optionset? Nope… it’s an N:N lookup

By | January 30, 2020

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.

Turned out it was not even that difficult to build this – all that was needed is to combine Select2 with PCF

The sources (and the solution file) are on github:

This is the first version, so it might not be “final”, but, so far, here is how this control is supposed to be configured:

  • You can use it for any single line text control
  • There are a few properties to set:
  • image

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):

7 thoughts on “Is it a multiselect optionset? Nope… it’s an N:N lookup

  1. Pasha Pilgrim

    Alex, what would be the scenarios to use it instead of the out of the box multiselect option set?

    1. Joergen

      One of the first scenarios I think about using n:n lookup instead of option sets – if your list of items can change over time – the N:N lookup may be the correct choice for you. Then you can add items and you can deactivate items without loosing historical data and without having an “ugly” list of items. An option set will be OK, when you have a static list of items without many changes.

      In addition, the N:N relationship can also store additional information, e.g. when you have added a specific item as you can see in the video above.

      1. Alex Shlega Post author

        That’s exactly it. Although, I still need to do some work on the component to make it work with active/inactive/historical/etc (and, possibly, with “filters” in general). Besides, multiselect optionset has some limitations (I think we can’t work with those fields in SSRS, for example). Although, N:N may have some limitations, too (workflow triggering, for instance).

  2. Raghu

    I’m afraid to say that Both the solutions fail to import. I’ve spent significant amount of time to rebuild the library but with no luck as I don’t know typescript works. Would you be able to just give us the NToNMultiselect control and the plugin solution pls. thanks in advance.

  3. Malcolm

    I have tried to install the solution but I get an alert saying the ita_checkitem entity is needed what am I doing wrong?


Leave a Reply

Your email address will not be published. Required fields are marked *