How to get OptionSet/ Choice text from DataVerse in Power Automate

Microsoft have recently introduced an easier way to get the choice text. Check this blog out.
If you can’t see this feature yet in your environment and you need an alternative way, please continue reading.

I am back with another blog on Power Automate and this time it’s again a question from citizen developer. I get this question every time I conduct Power Automate sessions with citizen developers.

When I show DataVerse and retrieve columns of various types inside DataVerse, the first question that usually come up is – How do I get the Optionset Text?

Let’s take a very simple example here.

I have a table called Visit Requests and inside this table I have column – Relationship of type Choice (formerly optionset)

Get Choice or Option set label in Power Automate

When I retrieve this table using DataVerse connector in Power Automate, I get a field called Relationship.

In the below screenshot, I am iterating through the list of Visit Requests records and taking the value of Relationship for each row of Visit Request.

Get Choice or Option set label in Power Automate

But what I get in return is the choice value.

Get Choice or Option set label in Power Automate

How can I get the text then? To understand that, let’s explore the raw output here.

Get Choice or Option set label in Power Automate

If you check the raw output, below is the JSON output of the same.

Get Choice or Option set label in Power Automate

To get the text, all I need to use an expression.

Get Choice or Option set label in Power Automate
items('Iterate_visits')['cr444_relationship@OData.Community.Display.V1.FormattedValue']

If you ask me, it’s cakewalk for a Dynamics 365/ Power platform developer. But for a citizen developer, this is kind of tricky. Also tricky is the regular question as to why there can’t be a property exposed to get the text value.

The above example holds good if you are using the List rows and iterate through record. What if you use ‘Get a row by id‘ action.

Get Choice or Option set label in Power Automate
outputs('VisitRequest')['body']['cr444_relationship@OData.Community.Display.V1.FormattedValue']

Here VisitRequest in the above expression is the name of the ‘Get a row by id‘ action.

Hope this helped!

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading