Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Answered

FetchXML Link Entity with Lookup Field relationship

(0) ShareShare
ReportReport
Posted on 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 at
    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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 69 Super User 2025 Season 1

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 49 Most Valuable Professional

#3
Jon Unzueta Profile Picture

Jon Unzueta 43