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

FetchXML to retrieve last child record

$
0
0

I'm building a report for my CRM app and need to figure out how to write the FetchXML statement.  I have two custom entities in a parent-child relationship.  I need to select all fields from both parent and child entities but for the child entity I only want to retrieve the latest record.  I have seen examples of how to achieve this using "groupby" and "aggregate" clauses but they only bring back the date column.  How do I fetch all the columns in the child entity?

<fetch aggregate="true" ><entity name="pois_indicator_results" ><attribute name="pois_performance_indicator" alias="pi" groupby="true" /><all-attributes/><attribute name="pois_due_date" alias="maxdate" aggregate="max" /><link-entity name="pois_performance_indicator" from="pois_performance_indicatorid" to="pois_performance_indicator" ><link-entity name="pois_pip_pois_performance_indicator" from="pois_performance_indicatorid" to="pois_performance_indicatorid" intersect="true" ><all-attributes/></link-entity></link-entity></entity></fetch>

Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>