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
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.
For anyone who may find this thread,
We simply have to replace the operator with operator='eq-or-under' and from='accountid'
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,188 Super User 2024 Season 2
Martin Dráb 230,030 Most Valuable Professional
nmaenpaa 101,156