Hello Techies,
We are currently in a CRM 2015 on-premises environment.
I'm tyring to implement a "bulk delete task" with the following FetchXML
<fetch distinct="false" no-lock="false" mapping="logical" > <entity name="contact" > <attribute name="fullname" /> <attribute name="telephone1" /> <attribute name="emailaddress1" /> <attribute name="address1_city" /> <attribute name="bdf_numbstreet" /> <attribute name="bdf_birthplace" /> <attribute name="bdf_birthdate" /> <attribute name="address1_postalcode" /> <attribute name="telephone2" /> <attribute name="contactid" /> <filter type="and" > <condition attribute="lastname" operator="like" value="%Tiers Demandeur%" /> <condition attribute="bdf_ishiddendemande" operator="eq" value="0" /> <condition attribute="bdf_isdeclareastd" operator="eq" value="0" /> <condition attribute="bdf_isanonymouscontact" operator="eq" value="0" /> <condition attribute="bdf_ishiddenrdv" operator="eq" value="0" /> <condition attribute="bdf_isrl" operator="eq" value="0" /> </filter> <link-entity name="serviceappointment" from="bdf_pris_par_personne_physique" to="contactid" alias="appointment" link-type="outer" > <filter> <condition attribute="bdf_pris_par_personne_physique" operator="null" /> </filter> <attribute name="bdf_pris_par_personne_physique" /> </link-entity> <link-entity name="incident" from="bdf_tiers_demandeur_personne_physique" to="contactid" alias="incident" link-type="outer" > <filter> <condition attribute="bdf_tiers_demandeur_personne_physique" operator="null" /> </filter> <attribute name="bdf_tiers_demandeur_personne_physique" /> </link-entity> <order attribute="fullname" descending="false" /> </entity> </fetch>
I'm trying to get the contacts that DONT figure in the "bdf_tiers_demandeur_personne_physique" column of the "Incident" entity and
the "bdf_pris_par_personne_physique" colum of the "serviceappointment" enity. The columns are lookups to the "contact" entity.
What changes should I make to EXCLUDE the contacts who are refrenced in the lookup columns of the "Incident(bdf_tiers_demandeur_personne_physique ) / serviceappointment (bdf_pris_par_personne_physique)".
Awaiting your valuable inputs.
Regards,
Clément
*This post is locked for comments
David. Many thanks. Works like magic. Cheers.
You need to move the condition clauses under the filter for the contact entity, and to add an entityname attribute that links to the alias of the link-entity. There's also no need to include the attribute element in each link-entity, as these will never contain data.
<fetch distinct="false" no-lock="false" mapping="logical" > <entity name="contact" > <attribute name="fullname" /> <attribute name="telephone1" /> <attribute name="emailaddress1" /> <attribute name="address1_city" /> <attribute name="bdf_numbstreet" /> <attribute name="bdf_birthplace" /> <attribute name="bdf_birthdate" /> <attribute name="address1_postalcode" /> <attribute name="telephone2" /> <attribute name="contactid" /> <filter type="and" > <condition attribute="lastname" operator="like" value="%Tiers Demandeur%" /> <condition attribute="bdf_ishiddendemande" operator="eq" value="0" /> <condition attribute="bdf_isdeclareastd" operator="eq" value="0" /> <condition attribute="bdf_isanonymouscontact" operator="eq" value="0" /> <condition attribute="bdf_ishiddenrdv" operator="eq" value="0" /> <condition attribute="bdf_isrl" operator="eq" value="0" /> <condition entityname="appointment" attribute="bdf_pris_par_personne_physique" operator="null" /> <condition entityname="incident" attribute="bdf_tiers_demandeur_personne_physique" operator="null" /> </filter> <link-entity name="serviceappointment" from="bdf_pris_par_personne_physique" to="contactid" alias="appointment" link-type="outer" > </link-entity> <link-entity name="incident" from="bdf_tiers_demandeur_personne_physique" to="contactid" alias="incident" link-type="outer" > </link-entity> <order attribute="fullname" descending="false" /> </entity> </fetch>
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6