I am trying to cite some data from Dynamics CRM 2011 using LINQ. The goal is to bring all Contact records that have changes from a specific date, or to have a child object (PERC files) from the same date. The request looks like this:
// Bring all students who have changes (at Contact entity) after specific date // momentInTime or the status of any of their perc files has been changed since // that date var students = (from c in ContactSet join pl in cga_portallogonSet on c.Id equals pl.cga_ContactId.Id join ef in cga_percfileSet on c.Id equals ef.cga_StudentId.Id where (pl.cga_PortalLogonRole.Value == 284970000) // student where (c.ModifiedOn >= momentInTime || c.CreatedOn > momentInTime) || (ef.cga_statuschangedate >= momentInTime) select c.cga_StudentNumber).Distinct().ToList();
The following error message will appear:
The Contact object does not contain an attribute with the name = 'cga_statuschangedate'.
I can't figure out how to do OR on two different objects. MSDN says that each entity requires a WHERE clause:
where is clause
To filter a result set where clauses can be added to one or more of> entities. Each where clause can contain only conditions related to the type of an individual object. > Invalid compound condition with multiple objects. Instead, each> object should be filtered in separate where sections.
http://msdn.microsoft.com/en-us/library/ff681565.aspx
Is there any other way to achieve what I need?
source share