Dynamics 365 (V9): Multi Select Option Set

By | October 10, 2017

There are a few things we can do with the old good option sets.. Can we do all of that with Multi Select option sets, though? Let’s see..

Although, let’s actually define a multi select option set first – here it goes:

image

From there, here is what I wanted to try:

  • Create a business rule condition
  • Set field values through the business rule
  • Create a workflow condition
  • Set field values through a workflow
  • Create a javascript condition
  • Set field values through a javascript
  • Create a C# condition
  • Set field values through C#

 

Quite a bit of work it might be, so let’s move on.

1. Creating a business rule condition

image

There seem to be no way to use a multi-select option set field in the business rule condition.

2. Setting multi-select field value through a business rule rule

Can’t do it either:

image

Basically, looks like multi-select option sets are not supported in the business rules.

Let’s have a look at the workflows, then.

3. Creating a workflow condition

My multi-select field is not available there:

image

 

4. Setting multi-select field value through a workflow

Can’t do it either – my new field does not show up on the form when configuring the update step:

image

Just to be sure, btw, I checked, quickly, that the field is on the form when I am updating the account record:

image

Well.. let’s try our last resort, the SDK.

5. Creating a javascript condition and setting a value

Apparently, in javascript multiselect option sets are represented by arrays. You can test it easily if you open any record in a web browser, and, then, use F12 to bring up dev tools. Notice that you will need to prefix Xrm with document.contentIFrame0 when doing it in the F12 console, btw:

image

Which means you can set a value as an array:

Xrm.Page.getAttribute(“new_testmultiselect”).setValue([100000000,100000001,100000002])

You can check how many items have been selected:

Xrm.Page.getAttribute(“new_testmultiselect”).getValue().length

You can set “null” to empty the selection:

Xrm.Page.getAttribute(“new_testmultiselect”).setValue(null)

And you can check if a value has been selected:

Xrm.Page.getAttribute(“new_testmultiselect”).getValue() != null && Xrm.Page.getAttribute(“new_testmultiselect”).getValue().includes(100000000)

It’s, actually, pretty good so far on the javascript side.

6. Creating a C# condition and setting a value

This seems to be a bit of a problem right now since we only have SDK for V8, but that version does not recognize Multi Select Option Sets. When trying to access such attributes from C#, we will be getting “null” all the time. It seems we might be able to make it look like V9 SDK by overriding SdkClientVersion property of the OrganizationServiceProxy  (and we can use something like “9.0.0.2072”), but, then, we also need to implement a data contract resolver in C# to deserialize those Multi Select Option Sets. Quite frankly, I’m a little stuck with that right now, so it may or may not work out.. Worst case scenario, it seems I’ll have to wait till SDK for V9 has been published by Microsoft (and, as of this moment, it’s not, yet, available) in order to try multi select option sets with C#.

5 thoughts on “Dynamics 365 (V9): Multi Select Option Set

  1. Bernard

    Does not work in combination with Business Processes either… 🙁 I was hoping to use Multi Select Option fields instead of making a whole bunch of booleans, but I am quite disappointed so far.

    Reply
  2. Wes Hammond

    Very disappointing but thank you for the article! I also notice that you’re not even able to update multi select option set fields in bulk edit either.

    Reply
    1. Vj

      We’re you able to find a workaround to achieve it?

      Any help would be greatly appreciated.

      Thank you!

      Reply
      1. matty

        Javascript is the only work around for front end stuff, plugins / custom workflows for back end stuff (5 years later, nothings changed from what i can tell)

        Reply

Leave a Reply

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