| Mustafa Usmani

FetchXML is vastly used to query data in your Power Portal Apps and in this blog, we are going to dive deep into how to use link-entity in our projects and link one or multiple entities in creating complex queries. In order to understand more easily, let’s take a look at the XML I recently used for a project.

So, this is the XML I used in order to fetch all the data from our Survey History (cr0d5_surveyhistory) table and all the surveys related to it from Survey (cr0d5_survey) table.

LinkEntityFetchXML

Now we can also use link-entity tag on our own to use related tables in our queries but there’s a very easy way that Microsoft provides us with and that is to use Advanced Find in your Power Apps environment, so let’s use that. We won’t be diving deep into what is an Advanced Find and how to use it but I highly recommend to read about it from here where it is explained in more depth.

After opening the Advanced Find, we have configured it with the basic information i.e which table to use (in this our Survey History table) and what should be the filtering condition.

LinkEntityFetchXML

Now once we click on select, we’ll see a bunch of table fields but also related fields that are used in the Survey History table that actually shows the relationship entities.

LinkEntityFetchXML

Here we can see all the related table fields that are in some relation with our Survey History table, and the field we want is Survey field that is highlighted in the picture above, we’ll select that and once we have selected it, the Advanced Find will “link” this related field with your query entity Survey History when we will download the Fetch XML.

LinkEntityFetchXML

All the link entities are highlighted in the Advanced Find, now let's click on Download Fetch XML in order to get our required XML.

LinkEntityFetchXML

After getting our XML, we can see that our related field Survey is now in a link-entity tag with pre-defined attributes like from, to, link-type and alias. The attribute that is important to us in order to fetch required related data is the alias. The Alias is a keyword that is used to retrieve data from the table using the ‘alias’ given to it. It works like a prefix for retrieving attributes of the entity. You can name it whatever you want it to be.

Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.



About The Blog

Stay updated with what is happening in the Microsoft Business Applications world and initiatives Imperium is taking to ease digital transformation for customers.


More About Us

We provide guidance and strategic oversight to C-Suite and IT Directors for on-going implementations. Feel free to give us a call.

1 331 250 27 17
Send A Message

Ready to Start?

Get a personalized consultation for your project.

Book a Meeting