Dynamics 365 Multi-Select Option Sets, I Like Them But


Back in the ‘good old days’ (version 4.0 😊) if you wanted a multi-select option set on your Dynamics CRM form, you could simulate one using jscript. There were a few variations but generally, what the user saw were labels and checkboxes and then typically the results of their ‘selections’ would be exposed as values separated by a delimiter and stored in a text field. And that worked pretty well for many scenarios. But it was custom code for every situation in which you wanted to use it.

Microsoft heard our cries and today we have built-in functionality that doesn’t require code, is reusable and provides a more complete ‘search/select/delete’ interface to the user. What’s not to like?

On the positive side

From the User point of view, there is a lot to like about being able to select multiple values. And, Developers don’t have to be involved, so they are happy. From the System Customizer point of view, it’s great to have a built-in functionality but there some limitations that are not readily apparent.

If you only need to display multi-select option set fields on a ‘main’ form or in a view, you’ve got not much to complain about. You just use the field as you would any other and put it where you want it:

Microsoft Dynamics 365 Partner San Diego Southern California

Microsoft Dynamics 365 Partner San Diego Southern California

What’s behind the curtain?

At first glance, because the field is surfaced as if it were a text field, I thought I should be able to use it in the same manner . . . but it’s not a text field, it’s actually an array and so therefore I can’t use it like a normal text field.

Let’s say I want to automatically display the current values of a multi-select field for a parent record on the form for the child record — for example, I create a Case for ‘ABC’ Account and want to automatically display the authorized ‘Product Lines’ on the Case form so the User knows which Products are supported for the Account.

Two approaches using normal configuration techniques would be:

  • Create a ‘Quick View’ Account form and insert on the Case form
    • Oops – the multi-select field can’t be used in a ‘Quick View’ form
  • Create a ‘Calculated’ field which looks up the value stored in the Account multi-select field and displays it as a field on the Case form
    • Oops – can’t access a multi-select to include it in the calculated field definition

Fortunately, jcript can be used to display the parent multi-select field on the child form but how handy would it be to be able to do that without coding? if it looks like a text field but it doesn’t quack like one . . . my bad.

Searching for a different kind of duck

As an array, we need to be careful about how we search for multi-select data in our Advanced Finds.

Your best friends will be the ‘Equals’ and the ‘Contain Values’ operators:

  • Equals
    • Multiple values in an ‘Equals’ clause will be evaluated like multiple ‘AND’ conditions
    • There must be an exact match returned based on all the search criteria or the search will fail
  • Contain Values
    • Acts more like a ‘text’ operator
    • Finds records that meet one (or more) of each value and includes them in the result set

If we execute this ‘Equals’ Advanced Find, we see that searching for the single value will return only records where the selected value is the ONLY value in the field (and not records where ‘Audi’ exists as one of many values in the field):

Microsoft Dynamics 365 Partner San Diego Southern California

Microsoft Dynamics 365 Partner San Diego Southern California

Searching for multiple values using ‘Equals’ will return only records where the 1st value AND all other values are in the field (AND there are no additional values in the field) – an exact match must be found:

Microsoft Dynamics 365 Partner San Diego Southern California

Microsoft Dynamics 365 Partner San Diego Southern California

On the other hand, using ‘Contain Values’ produces a larger result set:

Microsoft Dynamics 365 Partner San Diego Southern California

Microsoft Dynamics 365 Partner San Diego Southern California

In this case, looking for multiple values using ‘Contain Values’ finds all records where ‘Audi’ is found in the multi-select field value OR where ‘Nissan’ is found in the multi-select field value and returns them all (like a SQL ‘Union’ statement):

Microsoft Dynamics 365 Partner San Diego Southern California

Microsoft Dynamics 365 Partner San Diego Southern California

The Verdict

I do appreciate having multi-select functionality built-in and we’ve waited a long time for it. Perhaps in the future, we’ll be able to make use of those fields in additional ways without the use of code.

By John Clifton, Microsoft Dynamics 365 Application Consultant, Dyn365Pros, Microsoft Dynamics 365 Partner, San Diego, Southern California