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
Do you already checked logical/schema name and the publisher prefix of this entity?
Can you confirm if you are connecting to the correct CRM organization?
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
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....." );
It is breaking at Line 41 of CrudOperation.cs after running the console app.
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???
Hi Biplab, I can confirm that I have given only desired environment link. and correct prefix.
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;
return null;
See:msdn.microsoft.com/.../microsoft.xrm.sdk.messages.retrieveallentitiesrequest.aspx
If this solves, Please mark as "Verified Answer"
Hi Felippe Mendonça ,
where should I use above solution in my code?? any help please
any solution please ???
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
HR-09070029-0 2
ED-30091530-0 1