cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rrelopez
Frequent Visitor

Using Power Automate to update Option sets field's selected value

Hi,

 

I'm using Power Automate in creating a new record in a CDS entity (my data source is a SharePoint list and the flow gets triggered when an item is created to create the same record in CDS).

But I'm not sure how to map/pass values to an option set field in CDS. As you can see in the screenshot below, I'm using the 'Create a record' action and the highlighted ones are option set fields. For all other fields like text, date, or lookup fields, I am able to browse on the SharePoint items. But for fields that are of type 'Option sets', I'm only seeing the ID. Does someone know what parameter format should I pass to set the selected value of an option set in CDS?

 

Thanks in advance!

 

create a new record.png

not seeing other values.png

6 REPLIES 6
yashag2255
Dual Super User II
Dual Super User II

Hi @rrelopez 

 

Option sets in CDS have integers and labels on top of those. Therefore to pass it dynamically in the flow actions, you first have to navigate to the  CDS entity and then to the option set and note down the numbers assigned to the respective labels. Once done, in Flow, you can first initialize an integer variable and then create a switch action and then get the item from sharepoint, compare the text and set the variable to the respective option set integer value and then pass that variable in the create record action. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Thanks for your suggestion @yashag2255. I will try it.

 

Also, I'm just curious, does anyone know if there's a way to query/extract that specific label's integer instead of hard coding it to a variable integer?

 

Thanks

Reigningfear
Advocate III
Advocate III

Hello,

 

I am also curious about this @rrelopez . My use case requires me to know the integer value before updating a record since the data source is an excel with only the label value (text). Are option sets able to be queried like entities? 

This is from awhile ago, but I had the same issue with needing to get option set values based on the label, and I found the answer here: https://www.c-sharpcorner.com/article/get-option-set-value-based-on-label-in-microsoft-flow/ 

 

You can use the CDS "List records" action to query the "String Maps" entity, with a filter like:

 

objecttypecode eq '{entity}' and attributename eq '{field name}' and value eq '{label string}'

 

From there you can reference the attributevalue from the returned data to get the int value of the option. Hope this helps!

Shaboo992
Frequent Visitor

Easy Solution to update option set values from the parent records or related records. 

 

Example: Updating shipping method option set value from account to quote on creation 

Shaboo992_2-1623753130105.png

 

Get the option set values as you normally query as shown above steps

 

Updating Option set values 

The trick here is to enter custom value and select the dynamics value from get data step

Shaboo992_0-1623752944601.png

 

Sleeting the dynamics value should resolve the issue. The custom value will find the right matching option set value from the source

Shaboo992_1-1623753003304.png

 

The alternative solution to this is compose a step to store option set value and then use the output of the compose in a updating option value enter custom value option.

after hundreds of hits .. finally found solution here... marvelous

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,189)