Triggering Plugins on Update of Multi-Select Option Set in Dynamics 365

Jared Johnson, 18 February 2019

Dynamics 365 Version 9 added a largely-requested feature: Multi-select Option Set. While they are supported by most of the functionality of Dynamics 365 now, you will find that when you go to register a plugin step with a Multi-select Option Set as one of the Filtering Attributes or add one to a Pre/Post image that they do not appear in the list. Unfortunately, the Plugin Registration tool has not been updated yet to support the new field type.

To get around this, one thing I do when if I want to quickly add the Multi-select Option Set to the Filtering Attributes of a step is to use the Xrm.WebApi JavaScript functions to update them using the developer console like follows:

Xrm.WebApi.updateRecord("sdkmessageprocessingstep", "{STEPID}", {"filteringattributes":"mag_multiselectcodes"})

The only problem with this is that you cannot edit the Pre/Post images in this way.

To get around this we can edit the customisations.xml file of a solution. Be careful when doing this as you can corrupt the XML file.

1.    Makes sure to add at least one Filtering Attribute for the step or field to Pre/Post image that you want to add the Multi-select Option Set to. This will make sure we have the filteringattributes/attributes nodes in the XML
2.    Create an empty solution and add the steps you want to edit to it (or the steps that the Pre/Post images are for)
3.    Export the solution and extract the zip file.
4.    Open customizations.xml in your favourite text editor and look for the FilteringAttributes and Attributes nodes for the steps and images you want to edit, they will contain a comma separated list of the attributes selected in the Plugin Registration tool, you can then add the schema name of the Multi-select Option Set to these.
5.    Package back up the contents of the solution zip file into a zip and reimport.


Note that if you then try and edit the attributes for those steps/images again in the Plugin Registration tool they will be removed, and you will have to repeat this process.