Reputation: 229
I Have a fetch and I want to link an entity where 2 lookups contain to other linked entity ID's
Code:
<fetch mapping='logical'>
<entity name='serviceappointment'>
<attribute name='activityid' />
<filter type='and'>
<condition attribute='statecode' operator='eq' value='3' />
</filter>
<link-entity name='lead' from='leadid' to='regardingobjectid' alias='af' >
<attribute name='leadid' />
<link-entity name='contact' from='contactid' to='new_customer' alias='ai' >
<attribute name='contactid' />
</link-entity>
<link-entity name='new_record' from='new_recordid' to='new_record' alias='ag' >
<attribute name='new_recordid' />
</link-entity>
</link-entity>
</entity>
</fetch>
This works fine however I have another entity "new_linkRecordContact" that links the contact with the new_record via 2 look up fields "new_record" & "new_contact"
I can add the link-entity to either contact OR new_record but I want it to have a condition that it contains both the linked entity
Example:
<link-entity name='new_linkrecordrontact' from='new_record' to='new_recordid' alias='ag' >
OR
<link-entity name='new_linkrecordcontact' from='new_contact' to='contactid' alias='ag' >
but I want to use an AND instead of OR
The Logic:
'new_linkrecordcontactid' from 'new_linkrecordcontact' where 'new_linkrecordcontact.new_record' = 'new_record.new_recordid' AND 'new_linkrecordcontact.new_contact' = 'contact.contactid'
Any Ideas how to write that into a fetch?
Thank you
Upvotes: 0
Views: 1741
Reputation: 23300
Advanced Find allows to build any FetchMXL query you want, through these steps:
If Advanced Find can't give you the results you want, then you're facing a FetchXML limitation and have to turn to some other data retrieval method (OData, SDK). For example, you cannot apply a filter on fields which reside in different entities.
Upvotes: 1