Tuesday, February 7, 2012

CRM 2011 LINQ Left Join Through Entity Reference

Let's say we have a custom lookup field new_accountid on our phonecall activity (don't ask me why I don't just use from/to field :)) and that field is NOT a required field.

We want to get the account number using LINQ in our code somehow.

This is the way to do it. The trick is that we have to check whether the new_accountid is null and combine those records with the ones that are null.

Hope this helps, Andreas

No comments:

Post a Comment