Using Expand Query in Power Automate with Dataverse | Dynamics 365

Fredrik Engseth
4 min readNov 4, 2021
Example of multi step for retrieving related table

A simple example on how you can use the expand query in Power Automate to retrieve properties from related tables. Instead of listing cases and then have another action/step that gets the contact like the example below. (Example continues below the image)

Example of multi step for retrieving related table

You can solve the use of the extra step using expand query in the list record action. (More on how to below the image).

Image of the Expand Query field in the List rows action in Power Automate.

To find the properties you need for expanding the related tables you can do the following.

Step 1: Create a flow that uses the Dataverse List Rows action. In this example we trigger the flow manually and list cases in Dataverse. I have added row count to one to limit the amount of rows that gets listed.

Step 2: Next step I used the Compose action to output the result from the List Cases action. The output will be used to find the navigation properties that we need for expanding the related tables. Copy the output from the compose output.

Image of the output of a list rows action for retrieving cases in Dataverse.

Step 3: Open Visual Studio Code and search for navigation property. This property allows you to expand the related tables in the list rows action instead of using an own action step to retrieve the value for the related tables as previously shown.

Image of the navigation property from the JSON output in Visual Studio Code.

The properties in the example above is a reference related tables and can be expanded by adding them in the Expand query in the list rows action in the Power Automate flow.

The navigation properties from the image above:

  • subjectid
  • productid
  • owningbusinessunit
Fredrik Engseth

Developer | Dynamics 365 | Power Platform | Azure | Personal development | Investments