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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

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

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

I have the same question (0)
  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at
  • ChrisJC Profile Picture
    1,540 on at

    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

  • Verified answer
    Nithya Gopinath Profile Picture
    17,078 on at

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans