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 : 2hCiSrRl2U3H/RvWPU0NBo
Power Pages - General Discussions
Answered

FetchXML Link Entity with Lookup Field relationship

Like (0) ShareShare
ReportReport
Posted on 3 Feb 2023 15:49:19 by 167

Hi All,

 

I added a relationship between Contact entity and Customer custom entity in Power Portals. This created a Lookup field in Contact entity pointing to Customer entity. This works very well and is what I needed on the UI but I'm having trouble formulating a fetchxml query for this specific scenario. Below is my fetchxml query but it's throwing an invocation error. I've tried all sorts of combinations but can't seem to figure it out.

 

The lookup relationship field is cr8e8_customeraccountmserp and unfortunately, it is always blank when I try to log its value. I have confirmed in the dataverse that the field does have a value but it might be a whole object or some sort of pointer.

 

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
  <entity name="contact">
    <attribute name="contactid" />  
    <attribute name="fullname" />  
    <attribute name="cr8e8_customeraccountmserp" />
    <filter>
      <condition attribute="contactid" operator="eq" value="{{user.id}}" />
    </filter>
    <link-entity name="mserp_custcustomerv3entity" from="mserp_custcustomerv3entityId" to="cr8e8_customeraccountmserp.label" alias="mserp_custcustomerv3entity" link-type="outer">
      <attribute name="mserp_custcustomerv3entityId" />
      <attribute name="mserp_customeraccount" />
    </link-entity>
  </entity>
</fetch>

 

 

Categories:
  • Verified answer
    ragavanrajan Profile Picture
    7,036 Most Valuable Professional on 04 Feb 2023 at 08:29:25
    Re: FetchXML Link Entity with Lookup Field relationship

    Hi @gospa 

     

    The key thing required for lookup fetchxml is a "link-entity" element used to define a relationship. I can see you have link entity and from and to element. 

     

    If you are getting an invocation error, then there may be entity attribute misspelt, or incorrect entity relationships or unsupported operators used. 

     

    The easiest way I would suggest is to use the FetchXML builder tool to generate and validate FetchXML queries. 

     

    Official link below 

    FetchXML Builder  Â· XrmToolBox 

     


    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#2
Lucas001 Profile Picture

Lucas001 48 Super User 2025 Season 2

#3
KevinGador Profile Picture

KevinGador 44 Super User 2025 Season 2

Loading complete