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 CRM (Archived)

FetchXML to retrieve related records under parentaccount record

(0) ShareShare
ReportReport
Posted on by

Hi experts,

I am trying to construct fetchXML to retrieve count of cases that were created in the last 90 days for all account under and including the parent account.

For example:

Parent account A contains 1 case 

Child account B contains 1 case 

Child account C contains 1 case 

So the count in this case would be 3. 

I have the following fetchXML but when I test it on http://msxrmtools.com/fetchxml it is not returning correct values.

I'm sure there is something wrong with my xml. Please help as to what I can change to make it work. 

<fetch mapping='logical' distinct='false' aggregate='true'><entity name='incident'><attribute name='title' alias='recordcount' aggregate='count' /><filter type='and'><condition attribute='createdon' operator='last-x-days' value='90' /></filter><link-entity name='account' from='parentaccountid' to='customerid' link-type='inner' alias='ab'><filter type='and'><condition attribute='accountid' operator='eq' value='{EC2EAB2C-BF51-E811-A955-000D3A33EB4E}' /></filter></link-entity></entity></fetch>


Thanks.

Jon

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    on at

    For anyone who may find this thread,

    We simply have to replace the operator with operator='eq-or-under' and from='accountid'

  • Suggested answer
    sardar ahmed Profile Picture
    520 on at

    Hi Jon,

    I think you need to write another fetch to get the child account for the selected account and then pass them to your fetchxml to get the cases.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans