Retrieving the formatted label text from a choice in Power Automate when using Dataverse

Do you have a need to use a choice value as dynamic content in a Power Automate flow for something like a push notification, or to send an email? Power Automate can retrieve the dynamic context for choice columns on an entity record, however… READ MORE [https://lewisdoes.dev/blog/retrieving-the-
In: Low Code Lewis Content 🚀

Do you have a need to use a choice value as dynamic content in a Power Automate flow for something like a push notification, or to send an email? Power Automate can retrieve the dynamic context for choice columns on an entity record, however it doesn’t pull the label version of these choices for us to use straight away in further actions. Continue reading to learn how to retrieve the formatted text version of a choice value to use in further actions in a Power Automate flow when using Dataverse as a data source.

Step 1. Get a row by ID

In this example, I am trying to retrieve the ‘subject’ from a ‘case’ record in my Dataverse environment. First I need to use the ‘Get a row by ID’ action to retrieve the data for the record I wish to use. In the Row ID field of this step, I have used dynamic content from my trigger which is ‘When a record is selected’. This flow is run when a user triggers it via a button in Power Apps. Power Automate will pull the Row ID(s) of the selected record(s) to run the flow based on.

Now, Power Automate is using the Row ID of the selected record in Power Apps to retrieve information from. Now that Power Automate has the data around my record, I need to use the dynamic content being retrieved in my following actions. Before I can use my dynamic content for ‘subject’ though, I need to make it understandable as the text version of the choice value.

Step 2. Compose

I am now going to use the ‘compose’ action to pass an expression which will retrieve the formatted value ‘body’ of my choice. In the ‘inputs’ field of my compose step, I need to pass an expression similar to the one below. You can copy this, and replace ‘cr460_subject’, which is my choice name, with the name of your choice column. You can find the name of your choice in the solutions explorer of your environment.

outputs('Get_a_row_by_ID')['body/cr460_subject@OData.Community.Display.V1.FormattedValue']

Once I have my expression in the ‘inputs’ field of my compose action, I can proceed with using the outputs of my ‘compose’ step as the value of my choice in an action of my choice.

3. Use the ‘compose’ outputs from ‘dynamic content’

Now that I have converted the choice value retrieved by Power Automate to the formatted value so that it can be understood, I can use the outputs from my ‘compose’ step to dynamically update the ‘subject’ in a following step.

In my case I am using the ‘Send an email (V2)’ action using the Microsoft Outlook connector to send an email notification to someone using my data. My email is formatted using HTML code, but you don’t have to do this. Simply write your email content, then where you want to use your choice value (in my case, my ‘subject’ from my case record), you can just use the dynamic content ‘outputs’ from your ‘compose’ action.

Now you are using the formatted value from a choice column in your Power Automate flow!

I hope this helps!

Written by
Lewis Baybutt
Microsoft Business Applications MVP • Power Platform Consultant • Blogger • Community Contributor • #CommunityRocks • #SharingIsCaring
Comments
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to LewisDoesDev.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.