FetchXMLBuilder
FetchXMLBuilder copied to clipboard
Generated QueryExpression from FetchXml breaks if pulling a field from link entity
The following query expression is not valid:
// Instantiate QueryExpression QEcontact
var QEcontact = new QueryExpression("contact");
// Add columns to QEcontact.ColumnSet
QEcontact.ColumnSet.AddColumns("fullname", "telephone1", "contactid");
QEcontact.AddOrder("fullname", OrderType.Ascending);
// Add link-entity QEcontact_systemuser
var QEcontact_systemuser = QEcontact.AddLink("systemuser", "systemuserid", "createdby", JoinOperator.LeftOuter);
QEcontact_systemuser.EntityAlias = "a_92b8a9000846497cb93366ebb85f221f";
// Add columns to QEcontact_systemuser.Columns
QEcontact_systemuser.Columns.AddColumns("fullname");
This is generated from:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="contact">
<attribute name="fullname" />
<attribute name="telephone1" />
<attribute name="contactid" />
<order attribute="fullname" descending="false" />
<link-entity name="systemuser" from="systemuserid" to="createdby" visible="false" link-type="outer" alias="a_92b8a9000846497cb93366ebb85f221f">
<attribute name="fullname" />
</link-entity>
</entity>
</fetch>
Error is:
'Contact' entity doesn't contain attribute with Name = 'systemuserid'.
The link entity from/to fields seem to have got mixed up.
I guess #81 is not entirely solved, after all... Will have a look at this.
Looks like this is still an issue.
Works since...