I have been waiting forever for Microsoft to implement multi-select option sets (I’ll use MSOS going forward). When I was a CRM Admin at a previous employer it was the one thing I missed when we migrated from Salesforce to Microsoft CRM 2011. Finally, when version 9 was released I got my wish. However, this was not without some limitations. While they are great for finally capturing the data in a manner that is friendlier for end-users and a whole lot easier to configure for those building the solution, getting use out of that data for automation is not so easy. We are unable to use them in business process flows, business rules, and until recently, with some tinkering, in workflows.
I would like to first say that there is a workflow extension available that does allow you to use MSOS in workflows however it only returns the values of the selections and in a recent implementation, I needed the labels of the selected options as they were being included in an email.
Let’s say you have an MSOS on the Contact record and want to include the selected options in an email to the Contact.
To start, you will want to install Aiden Kaskela’s Workflow Elements. I’d like to take a moment to recognize Aiden and thank him for working with me to iron out some of the details in this process.
Next, create your workflow on the entity and after any conditional logic or other steps that need to be completed add the “Get Workflow Metadata” and “Query – Get Results” steps from Workflow Elements. Be sure to name your steps as they will be referenced later in the workflow.
[WAIT] Does your business struggle with siloed systems, disorganized service, or insufficient reporting? Learn more about Microsoft Azure >>
You don’t need to do anything with Get Metadata, but we will need to adjust some parameters in the Get Results step. Before we do that, we need to get the FetchXML that returns our MSOS for our record. To do this open the XRM Toolbox and bring up the FetchXML Builder. Once you have connected to your environment start a new query and build out your XML. Use the entity your field is on and add the MSOS field as an attribute.
Next, filter it by the entity record id. In this example on my Contact record it is contactid. When adding the field as a filter use the Generate Guid button to create a temporary placeholder in the XML. Once you are done, I recommend selecting the Mini option for formatting as you need to remove out all spaces and returns in your XML when you add it in the workflow step.
In an editor of your choice (or even notepad) remove the placeholder Guid and copy everything from the start of the xml to the double quote that preceded the Guid.
Open up the Get Results step, set “Table – Include Header” to false and paste in the first part of your xml into the last property value “or enter FetchXML to Use”. In the Form Assistant Look for:, select the name of your Get Metadata step and select “Workflow Record – Record ID” from its options. Add this dynamic value at the end of the xml you entered.
Now grab the remainder of the XML from the double quote after the placeholder guid to the end of the XML and add it after the dynamics value. If you were to copy out everything in that cell it should look something like this:
Now you can use the MSOS labels in other steps of your workflow. When you want to add it select the name of your Get Results step and use the “Single Value – Results as Text” parameter.
Here we have the email I sent through the workflow displaying the MSOS selections’ labels!