web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : 7Pi9dWxGineStueGWlwIsH
Power Pages - General Discussions
Unanswered

How to filter on lookup column in FetchXML

Like (0) ShareShare
ReportReport
Posted on 14 Nov 2022 03:55:23 by 105

There are two tables, Customer and Order, in Order table there is a lookup column pointing to the Customer table.

 

If already knowing the customer id (assume it's 3), and want to search all orders belong to this customer, in SQL query we could do something like below without using Customer table:

SELECT order_date FROM Order WHERE customer_id = 3

 

What's the equivalent fetchxml to the above SQL query? Do I have to use the <link-entity></link-entity> to use Customer to achieve the same filtering result?

 

 

Categories:
  • oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on 24 Nov 2022 at 06:57:16
    Re: How to filter on lookup column in FetchXML

    @jwnz Power Pages is not a model-driven app, however it has a model-driven app behind it, which is the Portal Management App

    From there you can export data, I believe Advanced Find is coming disabled by default now as this is being replaced by a more modern search engine: Modern advanced find with enhanced view management in model-driven apps | Microsoft Power Apps

     

  • jwnz Profile Picture
    105 on 14 Nov 2022 at 22:55:28
    Re: How to filter on lookup column in FetchXML

    @Fubar I assume Power Pages is not a Model Driven App, so wonder if Advanced Find is still available?

  • Fubar Profile Picture
    8,045 Super User 2025 Season 2 on 14 Nov 2022 at 22:14:10
    Re: How to filter on lookup column in FetchXML

    In a Model Driven App you can use Advanced Find to create a query and then download FetchXML.  For more advanced queries people would generally use the FetchXML Builder plugin that is in XrmToolBox.

     

    https://learn.microsoft.com/en-us/power-apps/developer/data-platform/use-fetchxml-construct-query

  • jwnz Profile Picture
    105 on 14 Nov 2022 at 20:31:16
    Re: How to filter on lookup column in FetchXML

    Hi @eugenevanstaden thanks.

    In Power Pages, is there a place that I could export this xml?

    <condition attribute="customerid" operator="eq" uitype="contact" value="{CD32B0AC-DC7F-EC11-8D21-00224810BB6F}" />

    Is there any documentation about fetchxml, would like to learn the meaning of each element, like the above line of code, what could be in attribute, uitype, value?

  • eugenevanstaden Profile Picture
    437 on 14 Nov 2022 at 08:48:13
    Re: How to filter on lookup column in FetchXML

    @jwnz 

    Like this below as the Customer field is on the Order table.

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
     <entity name="salesorder">
     <attribute name="name" />
     <attribute name="customerid" />
     <attribute name="statuscode" />
     <attribute name="totalamount" />
     <attribute name="salesorderid" />
     <order attribute="name" descending="false" />
     <filter type="and">
     <condition attribute="customerid" operator="eq" uitype="contact" value="{CD32B0AC-DC7F-EC11-8D21-00224810BB6F}" />
     </filter>
     </entity>
    </fetch>

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 2

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 2

#3
surya narayanan Profile Picture

surya narayanan 35

Loading complete