Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Invalid 'where' condition. An entity member is invoking an invalid property or method

Posted on by 145

 Hi , i'm trying to perform the following query which gets incident records with a specific subject, but an exception occurs :  Invalid 'where' condition. An entity member is invoking an invalid property or method.

Query:

 var cases = (from incident in serviceContext.IncidentSet
                where incident.SubjectId.Id.ToString().Equals("952f3039-bdf0-e811-a970-000d3a26cab0") // if the subject is "change email request"
                select incident).ToList();


  • Khaled Rimawi Profile Picture
    Khaled Rimawi 145 on at
    RE: Invalid 'where' condition. An entity member is invoking an invalid property or method

    nope, not working. Casting GUID to string doesn't work in the first suggested solution. The second one is actually the same as my query but in another fashion.

  • Clem Profile Picture
    Clem 2,541 on at
    RE: Invalid 'where' condition. An entity member is invoking an invalid property or method

    This solution might seems stupid but  try that way :

    var cases = (from incident in serviceContext.IncidentSet
                    where (string)incident.SubjectId.Id == "952f3039-bdf0-e811-a970-000d3a26cab0" // if the subject is "change email request"
                    select incident).ToList();


    Or try with Linq expression in this format : 

    var cases = serviceContext.IncidentSet
                    .Where(x => x.SubjectId.Id.ToString().Equals("952f3039-bdf0-e811-a970-000d3a26cab0") // if the subject is "change email request"
    .Select(x).ToList();


    Clément

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans