Hi,
I am trying to edit some FetchXML so that, on a linked entity, it only retrieves the most recent entry.
I am looking for a list of contacts who, on their most recent linked entity (A) record, have a linked entity (B) record with certain values.
I can build most of the query in advanced find but what i cannot seem to do is limit entity A to only the most recent record.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
<entity name="contact" >
<attribute name="fullname" />
<attribute name="telephone1" />
<attribute name="emailaddress1" />
<attribute name="new_practice" />
<attribute name="new_patientscheme" />
<attribute name="new_oasispatientid" />
<attribute name="new_nhsnumber" />
<attribute name="mobilephone" />
<attribute name="jacrm_isanadult" />
<attribute name="gendercode" />
<attribute name="createdon" />
<attribute name="address1_postalcode" />
<order attribute="createdon" descending="true" />
<order attribute="fullname" descending="false" />
<filter type="and" >
<condition attribute="statecode" operator="eq" value="0" />
</filter>
<link-entity name="cdi_postedsubscription" from="cdi_contactid" to="contactid" alias="aa" >
<link-entity name="cdi_subscriptionpreference" from="cdi_postedsubscriptionid" to="cdi_postedsubscriptionid" alias="ab" >
<filter type="and" >
<condition attribute="cdi_subscriptionlistid" operator="eq" uiname="Latest Oasis Dental Care News" uitype="cdi_subscriptionlist" value="{6DD8EF28-A842-E611-80EB-005056811B80}" />
<condition attribute="cdi_preference" operator="eq" value="1" />
</filter>
</link-entity>
</link-entity>
<attribute name="contactid" />
</entity>
</fetch>
Any and all help apprecaited!
*This post is locked for comments
I have the same question (0)