I am using the following code
QueryExpression query = new ("account") {
ColumnSet = new ColumnSet(
"accountid",
"name",
"primarycontactid"
),
Criteria = {
Conditions = {
new ConditionExpression("name", ConditionOperator.BeginsWith, "Cashmere")
}
}
};
LinkEntity le = query.AddLink(
linkFromAttributeName: "primarycontactid",
linkToEntityName: "contact",
linkToAttributeName: "contactid",
joinOperator: JoinOperator.Inner);
le.EntityAlias = "contact";
le.Columns = new ColumnSet("contactid","firstname","lastname","jobtitle");
var results = await _serviceClient.RetrieveMultipleAsync(query);
I have 3 results from the query all of which have a primarycontactid that exists in the Contact set however the link entity always returns 0. I have tried this with various different flavours and the link entity never has any results.
If I use a LINQ query, I am able to get both. What am I doing wrong with this QueryExpression.
AliasedValueobjects. Are you aware of that?