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 :
Customer experience | Sales, Customer Insights,...
Answered

How to write FetchXML that filters for all entities that are not linked to a related entity

(0) ShareShare
ReportReport
Posted on by 59

Hello all,

I have created a custom entity that links to the contact entity. There can be an arbitrary number of records of the custom entity referencing one contact (N:1). I want to create a view that only shows those contacts where no records of the custom entity pointing to it exists. I have found a way to create a view that filters only the records that have at least one associated record:

<fetch>
<entity name="contact">
<link-entity name="new_customentity" from="new_contact" to="contactid" />
</entity>
</fetch>

Is there a way to invert this view or how do I solve this?

Thanks

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
  • Verified answer
    Leah Ju Profile Picture
    Microsoft Employee on at

    Hi Nicolas,

    You can use a left outer join in FetchXML to perform a query that filters on the join table.

    You can perform a left outer join in FetchXML by using the entityname column as a condition operator. The entityname column is valid in conditions, filters, and nested filters. 

    You can refer to the following link for more examples:

    https://learn.microsoft.com/en-us/power-apps/developer/data-platform/use-fetchxml-left-outer-join-query-records-not-in 

    pastedimage1666664276282v1.png

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi Nicolas Krauter,

    Use Fetch Builder in XRM Tool Box and create queries using the user interface and get whatever format you like. It has all the options you required. Further details: FetchXML Builder for XrmToolBox - empower yourself to achieve more.

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

  • Suggested answer
    furkank Profile Picture
    535 on at

    Hi, You can use FetchXML Builder by Jonas Rapp. You can build more complex queries and Copy their XML's.

    see this link:  www.xrmtoolbox.com/.../

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 168 Super User 2026 Season 1

#2
NeerajPawar Profile Picture

NeerajPawar 65

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 51 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans