Describe the bug
A particular SQL query returns correct records but is not correctly converted to FetchXML.
To Reproduce
- Create two new Lookups in Account table to Contact: Billing Contact and Technical Contact
- Create Account1 record with 4 child Contact Records
- Set Contact1 as Primary Contact in Account1
- Set Contact 2 as Billing Contact
- Set Contact3 as Technical Contact
- Enter below SQL and execute
- Notice Contact 1, 2 and 3 returned correctly and not Contact 4
- Click Convert to FetchXML
- Run this in FetchXML Builder, and returns wrong result
SELECT contact.fullname
FROM contact, account
WHERE
(contact.contactid = account.primarycontactid OR
contact.contactid = account.new_billingcontact OR
contact.contactid = account.new_technicalcontact) AND
contact.parentcustomerid = account.accountid
Expected behavior
The FetchXML should be:
<fetch>
<entity name="contact">
<attribute name="fullname" />
<link-entity name="account" to="parentcustomerid" from="accountid" alias="account" link-type="inner" />
<link-entity name="account" from="primarycontactid" to="contactid" alias="acc_primary" link-type="outer" />
<link-entity name="account" from="new_billingcontact" to="contactid" alias="acc_billing" link-type="outer" />
<link-entity name="account" from="new_technicalcontact" to="contactid" alias="acc_technical" link-type="outer" />
<filter type="or">
<condition entityname="acc_primary" attribute="primarycontactid" operator="not-null" />
<condition entityname="acc_billing" attribute="new_billingcontact" operator="not-null" />
<condition entityname="acc_technical" attribute="new_technicalcontact" operator="not-null" />
</filter>
<order attribute="fullname" />
</entity>
</fetch>
Environment (please complete the following information):
- SQL 4 CDS edition: XrmToolBox
- Results of
SELECT @@VERSION:
Microsoft Dataverse - 9.2.25124.197
SQL 4 CDS - 10.3.0.0
feb. 04 2026 16:21:48
Copyright © 2020 - 2025 Mark Carrington
Describe the bug
A particular SQL query returns correct records but is not correctly converted to FetchXML.
To Reproduce
Expected behavior
The FetchXML should be:
Environment (please complete the following information):
SELECT @@VERSION:Microsoft Dataverse - 9.2.25124.197
SQL 4 CDS - 10.3.0.0
feb. 04 2026 16:21:48
Copyright © 2020 - 2025 Mark Carrington