Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:17:15+00:00 2026-06-04T19:17:15+00:00

I am trying to bring some data from Dynamics CRM 2011 using LINQ. The

  • 0

I am trying to bring some data from Dynamics CRM 2011 using LINQ. The goal is to bring all Contact records that have changes since certain date OR have a child entity (PERC files) changed since that same date. The query looks like that:

// 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();

This produces the following error message:

‘Contact’ entity doesn’t contain attribute with Name = ‘cga_statuschangedate’.

I cannot figure out how to do OR on two different entities. The MSDN says you need WHERE clause for each entity:

where Clause

In order to filter the result set, where clauses can be added against one or more of the >entities. Each where clause may only contain conditions against an individual entity type. >A composite condition involving multiple entities is not valid. Instead, each entity >should be filtered in separate where clauses.

http://msdn.microsoft.com/en-us/library/ff681565.aspx

Is there another way of achieving what I need?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:17:18+00:00Added an answer on June 4, 2026 at 7:17 pm

    Unfortunately you cannot achieve what you want in a single linq statement beacuse the liunq provider they use boils down to fetchXML, and fetchXML does not support the scenario you are using.

    More detail… Fetch gives you condition’s inside of entity’s or link-entity’s. These condition elements cannot have attributes in them from other linked entities, only the direct parent entity or link-entity. Here is one of many microsoft forum posts referencing this limitation of fetchXML

    Probably not the answer you were looking for, eh? As an ugly alternative you you can run two separate queries and filter in memory (as damaging as that may be to performance). Or better yet if you are an on-premise deployment you can write some sql against the filtered views. Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script that I'm trying to pull some data from a
I am trying to write some Linq to SQL that will bring me back
I am trying to wrap up some data from an array of BYTES into
I'm trying to write a small Powershell function that will return some summary data
Im trying to retrieve some data from JSON object which holds location information such
I am trying to make an asynchronous request to get some data from my
I've been going bananas trying to get some data from Javascript on one page
Using some random CSV data from data.gov, for example: Gravesite locations of Veterans and
I'm trying to get all the data from image file (jpg/jpeg/gif/png/bmp etc.) use Lua's
So i am trying to re-organise some data from the Google Places API, currently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.