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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Fetch XML Query - Linking to Entity

(0) ShareShare
ReportReport
Posted on by 1,112

I am relatively new to FetchXML and am trying to structure a query linking two entities.  These entities are respectively invoice and invoiceitem, with a one to many relationship.  Both share a common guid field:  ts_invoiceid, and I've confirmed that the same guid exists in both entities.  I can query the two entities independently, but if I try to join them together, nothing appears for the to entity.  The first entity in the query always displays, but the second linked entity appears as null.

In troubleshooting,

1)  I've reversed the order of the query, and it is always the to values that appear null.

2)  I've tried this selecting both all attributes and specific attributes and the results are the same

3)  I also tried applying a filter to narrow the scope of the query, but again have the same results.  

4)  I've also tried explicitly setting the link as an Inner Join

A sample of the query is below.  Is there anything syntax or structure wise that would be preventing the join?  Or anything else that may be a consideration?  Please advise.  Look forward to a response.

<fetch mapping='logical'>
      <entity name='ts_invoiceitem'>
       <all-attributes />
              <link-entity name="ts_invoice" to="ts_invoiceid" from="ts_invoiceid">
              <all-attributes />
               </link-entity>
</entity>
</fetch>

JG 

I have the same question (0)
  • Suggested answer
    meelamri Profile Picture
    13,218 User Group Leader on at

    Hi JG,

    How do you run your request? I recommend using the FetchXml Builder tool available on XrmToolBox, it will allow you to easily generate and execute your queries.

    pastedimage1622824030261v2.png

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 152

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 69 Super User 2026 Season 1

#3
ManoVerse Profile Picture

ManoVerse 65 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans