Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

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

Posted on by Microsoft Employee

Hello guys,

I need to do a SELECT in Linq C#, but don't work. My code:

                var name = "aa"

                var listAccounts = (from i in contexto.ContextoServico.AccountSet
                                    where 
                                    name.ToUpper().Contains(i.ojc_name.ToUpper())
                                    orderby i.ojc_name ascending
                                    select i).Take(10).ToList();


Can you help me ?

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Invalid 'where' condition. An entity member is invoking an invalid property or method.

    Hi Mahadeo,

    Thank you very much for answer ...

    I solved maked it:

    var listAccounts = (from i in contexto.ContextoServico.AccountSet

                                       where (i.StateCode == AccountState.Active && (i.ojc_name.Contains(nome.ToLower()) || i.ojc_accountnumber.Contains(nome)))

                                       orderby i.ojc_name ascending

                                       select i).Take(qtd.Value).ToList();

    We can'not to set ToUpper() in the property field of CRM. Only in variable of parameter.

  • Suggested answer
    Mahadeo Matre Profile Picture
    Mahadeo Matre 17,021 on at
    RE: Invalid 'where' condition. An entity member is invoking an invalid property or method.

    Hi..

    i think you need to change query like

     var name = "aa"

                   var listAccounts = (from i in contexto.ContextoServico.AccountSet

                                       where

                                       i.ojc_name.ToUpper().Contains(name.ToUpper())

                                       orderby i.ojc_name ascending

                                       select i).Take(10).ToList();

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans