web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

(0) ShareShare
ReportReport
Posted on by

Can anyone answer below question for my Console application???

social.microsoft.com/.../exception-the-entity-with-a-name-newemployee-was-not-found-in-the-metadatacache-while

Any help greatly appreciated.

*This post is locked for comments

I have the same question (0)
  • Felippe Profile Picture
    796 on at
    RE: Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

    Do you already checked  logical/schema name and the publisher prefix of this entity?

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

    Can you confirm if you are connecting to the correct CRM organization?

  • Suggested answer
    Biplab Singha Profile Picture
    on at
    RE: Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

    This Error will appear when the Organisation you are connecting does not have Entity with The Name.

    In Your Case there can be Multiple Environment . So check are you connecting the right Organisation or Not and also Check if you are using any other Prefix than "new_"

    Mark the answer as verified if it helps

  • MaddyBoss Profile Picture
    on at
    RE: Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

    Hi Vikas,

    Console app is running till (" Service Created ").

    Please find the onlineservice.cs

    public static OrganizationServiceProxy getonlineservice()

           {

               ClientCredentials credentials = new ClientCredentials();

               credentials.UserName.UserName = "***********";

               credentials.UserName.Password = "***********";

               var _servproxy = new OrganizationServiceProxy(new Uri("servername/.../Organization.svc"), null, credentials, GetDeviceCredentials());

               _servproxy.Timeout = new TimeSpan(1, 0, 0);

               _servproxy.EnableProxyTypes();

               WhoAmIRequest req = new WhoAmIRequest();

               WhoAmIResponse res = (WhoAmIResponse)_servproxy.Execute(req);

               if (res != null)

               {

                   Console.WriteLine("Service created.....");

                   return _servproxy;

               }

               else

               {

                   Console.WriteLine("Service not created....." );

                   return _servproxy;

               }

           }

    It is breaking at Line 41 of CrudOperation.cs after running the console app.

  • MaddyBoss Profile Picture
    on at
    RE: Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

    Hi, new entity with attributes will be created from CreateRecords() method of CrudOperation.cs  or only entity attributes ???

    Also, OnlineService.cs  can be used to call On-premise CRM 2013 ?

    Is it Okay???

  • MaddyBoss Profile Picture
    on at
    RE: Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

    Hi Biplab, I can confirm that I have given only desired environment link. and correct prefix.

  • Suggested answer
    Felippe Profile Picture
    796 on at
    RE: Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

    Do you publish your last changes?

    With this code, you can perform a create operation for a system entity like "account" for example?

    Just to make sure wich this error only occurs with the new entities.

    Another approach is to debug a code using the "RetrieveAllEntitiesRequest" on the target organization to see the entity organization metadata.

    If your entity not appears on the result  with the parameter : RetrieveAsIfPublished = false,

    publish that and check again.

    public EntityMetadataCollection ObterMetadadoEntidades()

           {

               RetrieveAllEntitiesRequest request = new RetrieveAllEntitiesRequest()

               {

                   EntityFilters = Microsoft.Xrm.Sdk.Metadata.EntityFilters.Entity,

                   RetrieveAsIfPublished = false

               };

               EntityMetadataCollection metaDataCollection = new EntityMetadataCollection();

               RetrieveAllEntitiesResponse response = (RetrieveAllEntitiesResponse)_orgService.Execute(request);

               foreach (EntityMetadata entity in response.EntityMetadata)

               {

                   metaDataCollection.Add(entity);

               }

               if (metaDataCollection.Count > 0)

               {

                   return metaDataCollection;

               }

               else

               {

                   return null;

               }

           }

    See:msdn.microsoft.com/.../microsoft.xrm.sdk.messages.retrieveallentitiesrequest.aspx

    If this solves, Please mark as "Verified Answer"

  • MaddyBoss Profile Picture
    on at
    RE: Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

    Hi Felippe Mendonça ,

    where should I use above solution in my code?? any help please

  • MaddyBoss Profile Picture
    on at
    RE: Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

    any solution please ???

  • Saroj Das Profile Picture
    3,355 on at
    RE: Exception "The entity with a name = 'new_employee' was not found in the MetadataCache."} while running the CRUD operation

    Hi Maddy,

    As Felippe suggested the MSDN link, you can add another method to your existing console application and add the code so it will write all your entities present in your solution/default solution to EntityInfo.xml file. So you can see your entity if exists in the file. And also sometime if you create/Delete entity through code, you need to Publish All the Customization or else it will say entity not exists/entity already exists in the solution

    Thanks,

    Saroj

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans