• Ajith Madathil

How to retrieve CDS Option Set Label Name?

This is something often mentioned in Power Automate community about how to retrieve the option set label name? There are different ways you can retrieve this. It's all depends on the connector you using in your Power Automate Step.


When you create an Option set it allow you to include drop down lists of fixed values to a user within your app to ensure data consistency. Behind the scene it stores the name and a numeric value.


Power Automate actions steps such as Get or List records retrieve the option set numeric values. Here are the ways you could retrieve the option set label name.


There are two types of CDS connectors available in Power Automate.


(a) Common Data Service

(b) Common Data Service (Default Environment)


















There are differences between these connectors.


If you using Common Data Service Connector you can directly get the option set name from List or Get Record. By default dynamic property shows the option set value only. See below in my example Type (Option Set) shows the dynamic property as Type Value which is the numeric value stored under the database. Label names are not shown under the Dynamic content.




















If you check your runtime history of flow Power Automate step Get or List action, here you can see the label names are retrieved.







You can use the expression to retrieve this


If you using the List action then you can declare a compose action step, click the expression and type the following:


items('Apply_to_each')?['_ajb_type_label']



Using the the above technique you can retrieve the option set label names. The same technique works with D365 connector as well.


The above technique won't work with Common Data Service (Default Environment) Connector. It only retrieves the Option Set numeric values. So how do we retrieve the label names for default environment connector?


CDS stores the option set details (Label Name & Value) under a system entity called StringMaps. This entity is not accessible via CDS entity interface (PowerApps > Data > Entities) but available via Power Automate action steps.



To retrieve the option set label name you need to know couple of things before hand. Entity name where lookup is defined, lookup attribute name and value of the attribute (numeric value)




Execute the above list record which will retrieve the label name 'Value'. See below.




Thanks for reading my blog.






92 views

Recent Posts

See All

The Compose action

Microsoft Power Automate (aka Microsoft Flow) provides lots of action steps out of the box. My favourite one is Compose. What does it do? What is the Compose action? The Compose action is like a stati

Blog Categories
 

Beginner

Intermediate

 

Advanced

Power Automate Essentials

How can I help you?

I am happy to help at any time.  You can contact me via the official PowerAutomate community forum.  Tag me (@abm) on any post you make there if you would like to me take a look at it.

I am always available for both corporate training or 1-2-1 training for individuals. 

© 2023 by Walkaway. Proudly created with Wix.com

  • Twitter Black Round
This site was designed with the
.com
website builder. Create your website today.
Start Now