Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

FetchXML to retrieve related records under parentaccount record

$
0
0

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


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images