cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mimocnik
New Member

How to handle option sets in Power Automate?

Hello!

 

I have a scenario: Virtual agent sends text to Power Automate (receive it as input) and there I would like to create a new record in Dataverse with filled out Option set. I tested and it doesnt recognize texts but you need to push ID there. I wonder how to say Text A = 100000, Text B = 100001, etc. I was wondering to go with conditions (yes, no) and then drill down but what if there are like 10 values available so it will be really too much IF statements to cover all. If I dont mention what if we get two or more Option sets as inputs from Virtual agent. 

 

Please advise!

1 REPLY 1
Expiscornovus
Super User
Super User

Hi @mimocnik,

 

One approach could be to embed an array with the labels and ids in your flow. You can use a filter array to get the correct id and use an expression in the add row action.

 

Below is an example of that approach. 

Drawback of this approach is that you need to maintain the optionset values in your flow. Alternatively, you could dynamically retrieve the optionset values via an HTTP action instead of the initialize variable action.

 

1. Add an Initialize variable of type array. 

 

2. Add a Filter Array. Filter the array on the label field value.

addresstype_array.png

3. Use an expression to retrieve the correct id of the corresponding label:

 

 

body('Filter_array')[0]['Value']

 

 

 

addresstype_array02.png

 

Hope this helps a bit? 

Helpful resources

Announcements
Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,584)