User Review( votes)
With every release of Dynamics 365, Microsoft introduces a wide variety of features. Some of which open new doors of opportunity whereas some help in overcoming existing limitations. Introduction of Multi-Select Option Set was kind of both.
However, as a customizer, we still face a few roadblocks when it comes to dealing with any Multi-Select Option Set field. However, recently while working on a requirement, we were able to set default values for a Multi-Select Option Set using Power Automate.
Now, let’s further explore how this was done.
Recently, we came across a scenario where we wanted to set values for the Multi-Select Option Set field named Regions based on the domain of the email addresses from two of the email address fields named Sales Email and Support Email. We achieved this by using Power Automate flows (Cloud Flows) as shown below.
On the Account entity form we have the Sales Email, Support Email, and the Regions field. The Sales Email and the Support Email are the email Id fields based on which we would need to set the value of Multi Option set field Regions.
For the above example, let’s say we have the Sales Email Id with the domain containing ‘.com’ whereas the Support Email Id has the domain containing ‘.au’. So now based on these, the Regions must get set as USA and Australia.
Step 2: Create a Power Automate flow.
To create a Power Automate flow navigate to Power Platform Admin Center -> Open your solution -> New -> Automation -> Cloud Flow -> Automated.
Step 3: Next, add steps.
Use the Microsoft Dataverse Trigger When a row is added, modified or deleted.
Then set the value of Change type to Added or Modified.
Added: Triggers on creation of a Record.
Modified: Triggers on updation of a Record.
Step 4: Add condition in the next step.
Step 5: In the conditional step we need to add the conditions. And as per the example, since we are setting the value of the Multiselect option set based on the values in the Sales Email and Support Email fields, we will use these 2 to add the conditions as shown below.
We have added the condition as, if Sales Email contains”.com” and Support Email contains “.au” then auto populate the Regions as “USA” and “Australia”.
Step 6: Post adding the condition, under If Yes add the action Microsoft Dataverse “Update a row”.
In Table name select the Entity/Table name on which flow needs to run (Executed).
Row Id is unique identifier of the Entity/Table.
In action we have passed the actual value of the regions using the custom expression.
To add the custom expression, we need to select “Enter custom value”.
In expression field enter the value of the option in Regions field/column à Click on save and the same will get set in the multi-option set field(i.e. Regions).
As per the example, the value of option USA is ’100000000‘and for Australia ‘100000003’ which will get set.
As illustrated above, we can easily set the values in Multiselect Optionset field by using Power Automate.