Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)
Under review by Community Managers

Under review

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

Invalid CRM 2011 LINQ Query: “Invalid 'where' condition. An entity member is invoking an invalid property or method.”

Posted on by Microsoft Employee

Hello

I am running the following LINQ query but it's throwing an error saying "Invalid ‘where’ condition. An entity member is invoking an invalid property or method."

protected override void ExecuterWorflow()
        {


            OrganizationServiceContext context = new OrganizationServiceContext(organisationProxy);
            //context.MergeOption = MergeOption.NoTracking;
            Dictionary exceptions = new Dictionary();
            //var nomsprenomscp = new string[] { "HAMZAJMERGIME69100", "FAYARDNATHALIE69009", "LELONGISABELLE69580", "SABYMICHELLE69680", "DE LIBEROMARIE ISABELLE69007", "DUTALISABELLE69003", "DURETMARIE 69002", "DJAROUMURIELLE69310", "COUVALCELINE69500", "ROSSILAETITIA69006", "DEDESSUS LE MOUSTIERHADIZA69005", "HUMBERTVINCENT69005", "COUTURIERSYLVIE69380", "BENSAMOUNJONATHAN69500", "TROMPIERPIERRE EMMANUEL69007", "SIGAUDCAROLINE69310", "BOISPASCAL69003", "GOUDINDOMINIQUE69600", "LORTHOISGREGOIRE69008", "DUBOISDAVID69330", "DIAZNATHALIE69800", "CELLIERNICOLAS69680", "ALI ISMAELABDOULKAFI69100", "CATINEAUMAXIMIN69130", "POCHONSARAH69003", "DEMOTIERSYLVIE69008", "LE MAISTRECHRISTOPHE69740", "CAMINOANAHI69100", "FAYOLLEMARIE69100", "DI CROCEBERNADETTE69800", "SAVEYNATHALIE69190", "JACQUETCHARLY69003", "FONTANELLAURENCE69120", "LETOCARTCELINE69001", "CHENJIANMIN69100", "ROBERTSYLVIE69008", "EL JERRARIKAWTAR69100", "MASENGOEDOUARD69120", "COICHRISTIANNE69100", "FREZIERCAROLE69003", "CAPLAINJEAN69100", "SAMARDCHRISTINE69300", "RYMSADANUTA69003", "BELLIONLAURENT69100", "BELISSONBENEDICTE69100", "BOUCHET CAROLECELINE69100", "LAZAREBERTILLE69008", "BOCCANFUSOANNE69007", "VETTORELLOCECILE69310", "TANZILLIGILLES69003", "MOANNATHALIE69006", "PIEMONTESEGIOVANNI69100", "DESCOTESYLVIE69450", "JOYEMICHAEL69006", "MEISTRETTYADRIEN69009", "DEBERNEMELANIE69600", "PONETPHILIPPE69100", "COCARDPATROCINIA69570", "VIELGERALDINE69001", "FERREIRAMARIA69007", "SCHOCHNICOLAS69570", "SINTESNATHALIE69160", "PESSIAANDREA69001", "VALENTINLIONEL69600", "LOMING69003", "DUVIERREEMILIE69008", "CHARVAZNICOLE69570", "PERONROGER69230", "MONTEILSEVERINE69001", "REYNIERSTEPHANIE69003", "SALVIMYRIAM69003", "BENZAZACHAHRAZED69190", "GIDONMARIE NOELLE69100", "JAILLETISABELLE69003", "VALADIERMARIE ROSE69100", "ZDOROVTZOFFSONIA69006", "FAUVETTHIERRY69001", "DA SILVA PIRESMICKAEL69100", "ALIMIBENJAMIN69600", "TEFFAHIZAHER69500", "CUSATTIMARCO69003", "LEGERCHRISTELLE69009", "DEPLATIEREBEATRICE69003", "CALVOCHRISTOPHE69800", "CHAPELLONCECILE69410", "VADEBOINAGNES69500", "DUCHIRONANNA LINE69160", "CHARPENETCLAUDE69350", "BREVET NIGILBLANDINE69300", "PAILLOUXJEAN FRANCOIS69003", "CULLAFROZMARIE PIERRE69300", "MORICEPATRICIA69100", "TREVEELISABETH69110", "GIBERTMARIE PIERRE69007", "PAPEREUXMARTINE69540", "RODETSANDRINE69140", "BOITONJOCELYNE69005", "MANSARDTHIERRY69100", "LAPIERREALAIN69190", "OJEDACELIA69230", "COURTADONPAULETTE69290", "COMMARMONDGERARD69009", "SIMONCHRISTELE69230", "BURGYJULIETTE69008", "LEMAIREAUDREY69100", "GAYBERTRAND69500", "BAJATMATHIEU69009", "LAURENTINMELANIE69003", "TRESFIELDJASON69310", "BOUVARDVERONIQUE69760", "MARTIN BOUREENATHALIE69780", "YOUSFIKELTOUM69100", "TRANSOPHIE69007", "TRACOLLAURENCE69007", "GOUTTENOIREFLORIAN69005", "GUYOTMARTINE69140", "PEILLEXEMMANUEL69100", "BELLABASNASSIRA69007", "CARBONNELTHIERRY69005", "ATTIE FLORIETTAMARA69001", "FORISSIERMICHEL69600", "FONBONNECATHERINE69100", "ARRIVATCHANTAL69500", "GUILLOTGILLES69100", "SAKNIANNE MARIE69003", "JIMENEZROBERT69630", "BUDASSIAMALIA69290", "DECLOITRESUZANNE69008", "BOIVIRENTHELENE69500", "BUFFETBRUNO69250", "COULANGETRISTAN69100", "GEMINNATHALIE69007", "GEAVIRGINIE69800", "PAULIENMARCELLE69007", "BARREAURELIE69006", "GAUTHIER CLERCALEXANDRA69003", "AUBATINAPOLLINE69300", "PILACHRISTINE69300", "ALTOUNIANVIVIANE69003", "JANIAUTANDREA69003", "PIANNECECILE69100", "BEAUDETGERARD69005", "RIZZOSEBASTIEN69290", "RADAISABELLE69005", "CHENPENGFEI69100", "SAINTE MARIE D'AGNEAUXROSELYNE69006", "LAURENTJACQUES69005", "LAURENTMIREILLE69005", "THOMYRECHRISTOPHE69002", "GUGLIELMIVERONIQUE69009", "AUBERGER GONCALVESFERNANDA69003", "MARTINEZTHIERRY69001", "MACHADO MENESESSAMUEL69001", "CHAMBONCHRISTINE69001", "VANINEVELYNE69003", "FRUTOSOSYLVIE69100", "MARTINNICOLE69004", "MICHELIS VANCELLSPASCALE69110", "CABIASDENISE69006", "MERCIERFABIEN69008", "VIENNOISMARION69100", "DREZETLYDIE69003", "PICARTTHIEBAUD69008", "ARRAGAINSYLVIE69003", "VASSIERMARTINE61360", "BAFFERTANNICK69600", "CARRONGERARD69008", "WULISCHLEGERVALERIE69100", "VEUILLETYVETTE69008", "PRETEMARIANNE69500", "MALLEVALFANNY69410", "BRIQUETJEANNE69003", "MARTINEZCONSUELO69008", "GASPARINIANNE69600", "DJABRLEILA69001", "SALAPATRICIA69100", "MARCHANDSYLVIE69100", "FAURECATHERINE69100", "MAJDARANNE AURELIE69130", "BACCAMSAIDENE69100", "PRIN-ABEILJEAN NOEL69500", "GRANDJEANHELENE69008", "SANCHEZMONIQUE69002", "CIAISMATHILDE69009", "BLANCGAELLE69002", "LE BORGNESOPHIE69002", "PELOUX DE REYDELLETMYRIAM69160", "REBOULBRUNO69003", "DUMASFLORIANE69008", "DAMIANICORELLA69004", "MAYNARDSYLVIE69100", "ARNAUDANDREE69300", "MORLEESTELLE69600", "DOUHERETSIMONE69600", "BESSENETRITA69005", "CHANTEGRETNICOLAS69270", "AVENASMARINA69006", "JOLYMARTINE69006", "BERTHET RAVASSOTMARIE ANGE69005", "MALLETGERALDINE69110", "CAMPANAJULIETTE69200", "MESSMERALINE69001", "MASINICAROLINE69330", "SUZZONIMARIE CLAUDE69007", "BRAGEEURYDICE69100", "GILISABELLE69800", "TROUSSIERYVANNE69005", "VOLAYOLIVIA69340", "MARTINMARIE HELENE69100", "SECONDOEMIMILIE69005", "DUCHENETHERESE69300", "PEGATANTOINE69006", "SASSIERJEAN JACQUES69004", "PALOMBORITA69800", "DUFAURE DE LAJARTERODOLPHE69001", "VINCENTSARHA69002", "SELLAMIKARIM69100", "BROSSIERSOPHIE69004", "BOISSIERSYLVIE69340", "ODEYERLAETITIA69500", "MURCIACATHERINE69300", "GENDREAUCHLOE69001", "PANEVIERECATHERINE69005", "TOURDESCELINE69500", "ORGIAZZIANNE69100", "ROUCHOUSECARINE69007", "MATHYMARIE CLAIRE69004", "CLEMARONTHERESE69007", "CLEMARONJULIEN69007", "IMBERTAURELIE69002", "SEVECHRISTOPHE69007", "MARTINFRANCOISE69001", "WISSLERISABELLE69160", "VINOTSANDRINE69008", "STROPOLINATHALIE69009", "BOUVIERTIPHAINE69003", "GHORZISARAH69100", "SEBILLEROMAIN69008", "QUENEHENJULIE69001", "DELAIREDAPHNE69006", "BARBETANTOINE69003", "BARBIERGREGORY69003", "CAUREGINE69008", "RIOTTEDANIELLE69003", "BOUSTANNE69330", "GONZALEZPIERRE EMMANUEL69200", "FRANCOZBRUNO69005", "DYONISABELLE69600", "MIGNOTCHRISTINE69100", "REVOLISABELLE69007", "BERTHONTHIBAULT69003", "DESPAUXSANDRINE69600", "BRAUNPATRICK69002", "CHESNELOLIVIER69003", "HAMMOUSARAH69003", "CHANDRUMONIQUE69008", "MAKRIDESSEVIA69007", "QUINCIEULUCILE69300", "CARRAZANASTASIA69002", "BOTMIMICHAEL69780", "BRONCHARTSTEPHANE69008", "BERROUABDELLAH69003", "DECLERIEUXSTEPHANE69003", "RABARY MORATEURCHARLINE69100", "COQUELINOLIVIA69100", "SIRBU FIRICELALINA69006", "PEDERICKCLAIRE69800", "BONJOURALIZEE69006", "HAMADIMOHAMMED69200", "MOUTTAQIZAHRA69100", "CABITNADIEGE69008", "ROILLETDANIEL JEAN69001", "CANDELCHRISTINE69008", "LACHARMEADELINE69004", "DUSSERTCORINNE69004", "NAVARROLAURENT69009", "LOZACHLOIC69100", "ANGERCLAIRE69009", "GOUTAGNYNADEGE69160", "VERNEYLAURENCE69008", "MANOUBIZINA69800", "ZIMMERLINKATUTA69003", "MOCOGNIJOCELYNE69100", "DI FEDEROBERT69008", "PARISETAUDE69300", "NEKAFARID69190", "VEDELDENIS69480", "FREMCOURTOLIVIER69007", "AYACHIMYRIAM69009", "SAVETJEREMY69800", "TELLIEREMILIE69100", "DURYBASTIEN69100", "GRANGESYLVAIN69009", "MOUNIERJEAN PIERRE69300", "GRANGEASSECAROLINE69510", "CHALINETLAETITIA69780", "BARBEDETTENOEMIE69004", "CREGOJULIEN69008", "BERETTAEMMANUELLE69009", "SIBELLESANDRINE69006", "DURGUEILCLEMENCE69007", "CHARRECOLIN69150", "MASELLACYRIL69009", "BOUKADIAGISELE OLGA69009", "SALHI GHEZOUANESAMIA69330", "CHATZDAMIEN69002", "CROZENATHALIE69300", "MALERSTEPHANE69100", "POCHONELODIE69100", "BORDPAULINE69006", "FAWZIOMAR69008", "LOUISFRANCIS69007", "MASSONTHIERRY69360", "PORCHERDAVID69007", "MEATTERAMICHELE69100", "BLAHAYELSA69500", "DE LUMLEYAMAURY69160", "MOMMERTMARINE69007", "LAFONT COUTURIERHELENE69003", "GUIFFRAYPAUL69260", "CHAMPIONPIERRE69007", "MICHELETGARRY69100", "LEFEVREMARIE69500", "CREUZEVEAUMARIE69004", "SIRETFABIEN69100", "GALETNATHALIE69110", "LUCETDENIS69008", "BEN AMARAMOHASSEN69001", "RIVELLINISEVERINE38122", "REVOLEMILIE LOUISE69007", "GAUCHERANDDOMINIQUE69003", "LANOUARLAURENCE69100", "BOURRETANNE FRANCOISE69002", "DJEGHROUDDALEL69003", "DELL OROVERONIQUE69230", "MILLETSEVERINE69100", "BAILLYNATHALIE69009", "CANNASLEA69007", "BLANCINES69200", "CHARREYREBENOIT69001", "DAOUDIANNE69190", "VESINMONIQUE69002", "TALLONJULIEN PAUL69008", "LAGRUE DE MARIIRIS69008", "DELARUEYVES69003", "SALMAINLAURA69007", "AMARIASSIA69100", "LEGLANTIERMARIE CELINE69300", "MAIRETCEDRIC69009", "VERGESVIVIEN69004", "DERHEETIFFANY38540", "BOUSSAHASABRINA69007", "GUYOTCAROLE69100", "BALSEMINJEAN MARC69001", "FRANCOISBEATRICE69004", "GIRAUDFRANCK69100", "MONTOYAMATTHIEU69150", "BISSARDONFLORENCE69500", "CORIGLIANOODILE69003", "ALVAREZDAVID69008", "BLANCHARDLAURIANE69100", "ROYDEBORAH69300", "REGISMARJORIE69330", "BOUGHANMISAMIRA69200", "DJIDJIERIC69300", "BAHRI SOUISSIFAHIM69200", "CHAMPIONJOELLE69250", "BENGOUASARAH69009", "RATTEGEOFFROY69140" };
            List nomsprenomscpdevtry = new List( new string[]{ "BERNARDMARTIN", "MILDOUDKANDIL" });
            
        
            try
            {
                List PPLyonIds = new List();
                PPLyonIds = (from pp in context.CreateQuery()
                where nomsprenomscpdevtry.Contains(string.Concat(pp.nom.ToUpper(),pp.prenom.ToUpper()))
                select pp.Id).ToList();

                logger.Debug(" nombre des ids"   PPLyonIds.Count);


                var listReponseUpdate = (from rep in context.CreateQuery()
                                         where PPLyonIds.Contains(rep.personne_physique_cible.Id) && rep.Id == Guid.Parse("4B90DEA4-680C-EA11-80FE-005056B14DD3") //Guid.Parse("02D8C217-9ABE-E911-80E4-005056B2DCF2")
                                         select rep).ToList();


                foreach (Reponse_de_campagne re in listReponseUpdate)

                {


                    try
                    {

                        logger.Debug("debut mise à jour de la réponse campagne");
                        Reponse_de_campagne reponsecampagne = new Reponse_de_campagne();
                        reponsecampagne.Id = re.Id;
                        reponsecampagne.rechercher(organisationProxy);
                        reponsecampagne.retour_souscription = true;
                        reponsecampagne.sauvegarder(organisationProxy);
                        logger.Debug("La personne physique sous ID"   re.personne_physique_cible.Id   " est mis à jour");


                    }

                    catch (Exception ex)
                    {
                        if (exceptions.ContainsKey(ex.Message))
                        {
                            //Erreur déjà rencontré
                            exceptions[ex.Message]  ;
                        }
                        else
                        {
                            logger.Error(ex.Message   "\n"   ex.StackTrace);
                            exceptions.Add(ex.Message, 1);
                        }

                    }
                }

            }
            catch(Exception ex)
                    {
                if (exceptions.ContainsKey(ex.Message))
                {
                    //Erreur déjà rencontré
                    exceptions[ex.Message]  ;
                }
                else
                {
                    logger.Error(ex.Message   "\n"   ex.StackTrace);
                    exceptions.Add(ex.Message, 1);
                }

            }

        }
    }

Cordially

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