Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

View of parent records with no child - both same record type

Posted on by 1,540

I have a a lookup field on Project Task (part of PSA) that looks up to Project Task.

I need a list of records that are the lowest level, i.e. they have no child Project Tasks.

I have followed this article before and it works well where the parent and children are different entity types: http://celedonpartners.com/blog/microsoft-dynamics-finding-parent-records-with-no-child-records-using-xrmtoolbox-and-fetchxml/

However I'm now getting and error on my condition that it doesn't know which entity to filter on. Can I use an alias or something to reference the child?

My XML:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
                <entity name="msdyn_projecttask">
                  <attribute name="msdyn_subject" />
                  <order attribute="msdyn_scheduledstart" descending="false" />
                  <link-entity name="msdyn_projecttask" from="msdyn_parenttask" to="msdyn_projecttaskid" alias="aa" link-type="outer">
                  </link-entity>
                    <filter type="and">
                      <condition entityname="msdyn_projecttask" attribute="msdyn_projecttaskid" operator="null" />
                    </filter>
                </entity>
              </fetch>


*This post is locked for comments

  • Verified answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: View of parent records with no child - both same record type

    Hi,

    To get the accounts who don't have child accounts, use the Fetch XML below.

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

    See: https://community.dynamics.com/crm/f/117/t/236450

    Hope this helps.

  • ChrisJC Profile Picture
    ChrisJC 1,540 on at
    RE: View of parent records with no child - both same record type

    Hi Nithya,

    Thanks for the link. I had seen that article aswell and it leads to the same FetchXML as the one I posted.

    However the parent and child entities are different. In my case they are both the same entity.

    Thanks,

    Chris

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: View of parent records with no child - both same record type

    Hi Chris,

    See: http://www.itaintboring.com/dynamics-crm/dynamics-365-finding-all-parent-records-that-have-no-child-records/

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