Retrieving MultiSelect Option Sets in Dynamics 365

Retrieving MultiSelect Option Sets in Dynamics 365

I was excited when Microsoft introduced multiselect option sets in Dynamics 365 Customer Engagement v9.  On a recent project, we noticed that SSRS reports cannot retrieve the multiselect fields.  When you create an SSRS Report for Dynamics 365 using FetchXML that includes an MultisSelect Option Set attribute, you get the following error message:

The attribute type “MultiSelectPicklist” is not supported. Remove attribute “new_education” from the query, and try again. (mscorlib)

The problem was detected using Visual Studio 2015, Dynamics 365, version 9.0 Report Authoring Extension, when connected to Microsoft Dynamics 365 Version 1710 (9.1.0.1856) online.

Solution

There are ways around to resolve this issue by creating custom workflow plugin. Using SDK each entity object contains a dictionary of FormattedValues and we can read from there the options that were selected by the user.

Steps.

1. Create custom field type Single Line of Text to store a semi-colon separated values of the selected values in the MultiSelect option set field. In our example the new field can be called “new_education_text”

2. Create a custom workflow assembly that accept two input parameters.

  • Multi-Select Field (logical name)
  • Text Field (logical name)

The code of the custom workflow is shown below.

Script code to the Workflow Assembly

3. In Dynamics 365, Create synchronous process, category workflow for the particular entity that contains the MultiSelect option set field. In our example was made for an entity called Assessment.

4. In the options, make this workflow starts when record is created and when records fields change, checking the MultiSelect option set field there.

5. Add a step that uses the new custom workflow assembly

6. Clicking in properties of the step, enter the parameters

What is Next

Next time when a new Assessment record is created or an existing record is updated, the custom field new_educationtext will contain semicolon separated values of the options the user selected on the source attribute MultisSelect Option Set.

nusoftso
})(jQuery)