Using values from Dataverse Choice and Choices columns in Power Automate flow

Published on

in

Hello PowerUsers, welcome back to my blog. Today, I am going to show you how to read values from the Choice and Choices columns which are present in Dataverse in Power Automate Flows.

Lets say we have a table Items and it has a Choice column named Category and Choices column named Tags.

Choice column: Category
Choices column: Tags

We have a flow which will be triggered whenever a new item is added, modified or deleted from this table and in the flow we want to fetch the values of Category and Tags for each item.

Lets take a look at the below flow. Here, we are directly trying to use the column names available in the Dynamic Content and assign them to variables.

Now, lets check the output of the above flow:

Values from Choice Column stored in varCategory but no values from Choices Columns stored in varTags

As seen above, the value of varCategory is 717620000, which is available in the property blog_category (below). And the values of the Tags column is not available in the output of the trigger body.

So first thing first, we will try to get the value of the Choice column Category field and that can be done by reading the value of the property _blog_category_label.

Modification in the flow:

Method 1. Using triggerOuputs()
In the Initialize variable step, change the value of variable varCategory to triggerOutputs()?[‘body/_blog_category_label’] using Expressions as shown below

Expression

Method 2. Using Get a row by ID

In this, we will use the outputs of Get a row by ID action. So lets add this action first as below.

Adding Get a row by ID action

and add a new action to initialize a variable which will store the value from the output of the Get a row by ID action.

Use the below expression:

outputs('Get_a_row_by_ID')?['body/blog_category@OData.Community.Display.V1.FormattedValue']
Getting the value from the outputs using

Output when the above flow gets executed:

Output

Now that we have successfully fetched the value from the Choice type column, lets work on the Choices type column.

Modification in the flow:

We will use the outputs from the Get a row by ID action to get the values of Tags column as we did in Method 2 above. As we saw in the outputs of the Get a row by ID, the tags values are available in body/blog_tags@OData.Community.Display.V1.FormattedValue property.

Use the below expression to assign the value to varTags variable:

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

Output of this is that the variable varTags has now all the values as a string.

Thank you for sticking by. Hope you found it helpful. See you in my next blog.

6 responses to “Using values from Dataverse Choice and Choices columns in Power Automate flow”

  1. Florian Avatar
    Florian

    Hello and thanks for sharing! This helped me working on my flow. Do you also have a hint when it comes to use multilingual choice fields (translation feature)? I’m using your methodologie to get the label from a choice field and add it to an email. The email has two languages inside. Now I want to pick the right label with language sensitivity. Thanks !

    Liked by 1 person

  2. Emily Avatar
    Emily

    This didn’t work for me. I get the error:
    “Correct to include a valid reference to ‘Get_a_row_by_ID’ for the input parameter(s) of action ‘Initialize_variable’.

    Liked by 1 person

  3. James Avatar
    James

    Hi Hi Emily, I’d be happy to help you. if you have renamed the “Get a row by ID “ action which is being referenced in the Initialise a Variable action, please make sure you are using the correct name of the action.
    Otherwise please share the step at which you got this error.

    Like

  4.  Avatar
    Anonymous

    This is crazy… why can’t Microsoft simply return the display.formatted.value and make it available to choose in the data picker, avoiding parsing?

    Liked by 1 person

    1. jakemannion Avatar

      don’t know if I’ve agreed with an Anonymous comment on the internet harder than this before 💯

      Liked by 1 person

      1. James Yumnam Avatar
        James Yumnam

        Yeah! I totally agree. We can submit this an idea to PowerApps forum, if already not submitted.

        Like

Leave a comment