Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Find Accounts who do not have child accounts

Posted on by 1,875

Hi

I have to find all account records that are at lowest level in the hierarchy, means accounts with no child account records. Is there any way to do this by LINQ, FetchXML or Query Expression?

*This post is locked for comments

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Find Accounts who do not have child accounts

    Hi,

     try this:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">

     <entity name="account">

       <attribute name="name" />

       <attribute name="accountid" />

        <filter type="and">

           <condition entityname="childaccount" attribute="accountid" operator="null" />

       </filter>

       <link-entity name="account" alias="childaccount" from="parentaccountid" to="accountid" link-type='outer'>

       </link-entity>

     </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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans