Use Microsoft Flow to Handle MULTI-SELECT OPTION SET

I was thinking about Flow a few days ago and how it could do more than classic Dynamics workflows.

This got me thinking about some of the common issues faced with Dynamics workflows and how we can solve these transitions.

So, the question is “Can Flow handle something like Multi-select option sets, which is not possible through Dynamics workflows?”.

I set out to find out if it worked, and guess what? It does, and it works great. Read on to find out how I did it.

I have multiple contacts and I want to use a multi-select option set to capture what type of contact it is.

So, I want a workflow to compare the selected values in the Multi-select Option Set and do something if my condition is met or not. sounds simple, let’s dig in.

When we open our standard classic Dynamic Workflow to set the condition for our Multi-select Option Set the field is not available in the condition, it simply is not available to pick. Neither can we update it on the form.

Usually we look for a workaround using plugin, code activity or JavaScript. But instead of writing code we can simply use flow that can run conditions and update multi-select field in D365/Common data service and here is how.


Step 1:

Start by creating multi-select option set field.

Then set up a simple Flow with a D365, it can be on the record created or record updated, up to you and doesn’t matter. Then add a “Compose” action and set the value as your Multi-select Option set field, we will use this compose later. In my example there were four fields, called “Member”, “Sponsor”, “Volunteer” and “Other”.


Step 2:

Run a quick test to see if it returns some values, and you will notice that it brings back an array separated by a comma.

Use this test going forward so that you don’t have to go back to D365 and keep updating the record. Stay in Flow from now on while testing.


Step 3:

Add another step to Initialize variable and set the type as String and value as your Multi-select Option set field value. In my case, I have set the value 860530000, which is the value of Volunteer.

Add another step to get the output based on the condition either true or false.


Step 4:

Now, set up the condition. Choose “Condition” as your action.

In the first box put the value returned from our trigger, in my case its “Contact Type”. Next, the operator should be “Contains” for obvious reasons (it will never equal if more than one) and in the right box put our Variable “Contact Type volunteer” value from Step 3.

We do that because they are both the same “type” otherwise there is an integer and a string, and you will get errors. This is avoided. You could use an expression to change your inputs, but I find this way simpler and more transparent when scanning.


Step 5:

Add your steps if your condition is met or not. For this demo I have Set the Variable Output to show the text for Volunteer if exist. Test it and see that it works, beautiful. This is just a small example but using the flow you can now do all sorts with your multi-select fields.

Conclusion:

Hope this article has helped you overcome a major problem faced by many CRM users. Below are a few blogs which can help you resolve other Dynamics 365 problems and development issues: