CRM Crate

Dynamics 365 | Understanding & using an Expand Query in Power Automate

Estimated reading time: 5 minutes

In this course, we will learn to use an expand query in Power Automate with Dynamics 365 CRM. Before we start, make sure to subscribe to CRM Crate so that you stay up-to-date in field of Microsoft Dynamics 365 CRM and related technologies.

What is an expand query and why do we need it?

If you are utilizing the dataverse connector in Power Automate then you may have gone through a parametrize input called “Expand Query”.

An expand query is a low-code replacement of “Link Entities”. With help of an expand query, we can retrieve the attribute values of the related entities. For example, consider we have a primary entity called “Research & Development”. The entity “Research & Development” have a lookup field of entity “Subscriber” associated with it. Now, with help of an expand, we can get the attribute values of entity “Subscriber” when the primary entity “Research & Development” has been used in the dataverse connector.

Create a Power Automate flow to use the Expand Query.

  • Open the Power Automate studio and create a blank new flow as shown below.
  • We will trigger our flow when there is an update in the record of entity “Research & Development”. Navigate to the search box and select the connector as “Dataverse” >> “When a row is added, modified or deleted” as shown below.
  • Configure the flow trigger by selecting appropriate trigger type, entity name and scope.
  • Now, lets call a dataverse action (Get a row by ID) to retrieve a particular entity record according to the output provided by the above created trigger as shown below.
  • Here we can see an additional parameter called “Expand Query”. In-order to retrieve the related entity’s attribute values, we will write a new expand query expression.
  • Consider the above scenario where we will use the related (Subscriber) entity’s attribute called “CRM Crate Notes”. Below is the generated expression to retrieve field “CRM Crate Notes” from the related “Subscriber” record.
  • Here the “cc_Subscriber” is the lookup field schema name in the Research & Development entity and the “cc_crmcratenotes” is the name of the string field present on the related (Subscriber) entity.
  • Now lets print the expand query output in a Power Automate variable. In the newly initialized variable, navigate to the field “Value” and add the dynamic data which is been generated by the above created expand query. In our case, the dynamic content would be named as Subscriber CRM Crate Notes.
  • Save and trigger the flow to test the expand query. Below we can see that the expand query has successfully retrieved value from related entity’s attribute “CRM Crate Notes” as shown below.

Thus we learned to use the expand query in Power Automate flow with Dynamics 365 CRM.

3.8 4 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
error: CRM Crate Security Engine - Disabled Right Click & Selection!


Well Done,
Welcome to CRM Crate

Stay tuned with us and get all latest updates and learning in Microsoft CRM and related techonologes.