Geeks With Blogs
Wes Weeks

While performing an update to some code originally written for CRM 3.0 which I was upgrading to 4.0 and using the new 2007 version of the web services, I found myself getting an unusual error during one of the callouts.  The code created a new custom entity from the data in an existing entity.  This code was orginally written by another party and I"m not sure why they didn't use the mapping features in CRM to do this but it was coded manually.

The entity with typecode '8' was not found in the Metadata Cache.

Never having seen this before it of course took a lot of time digging through the event viewer and trace logs to find the source of the error.  In this case, it came down to one line:

newEntity.OwnerId = originalEntity.OwnerId

In a nutshell: the 'type' attribute on the originalEntity which had just been read out of CRM using the web services was '8', however when creating/setting the type on create the attribute field needs to be the name of the entity.  In this case, since the owner was a system user, the type field needed to be set to 'systemuser'

One would think that the inbound and outbound values could be the same or possible set up to parse for both a type code of or the type name.....

Anyway, if someone else comes across this or a similar problem, I hope this helps.

Posted on Sunday, September 7, 2008 7:12 AM Microsoft CRM | Back to top


Comments on this post: Entity Typecode not found in Metadata Cache

# re: Entity Typecode not found in Metadata Cache
Requesting Gravatar...
thanks a lot.

It was of great help
Left by Nand on Jul 20, 2009 7:17 AM

# re: Entity Typecode not found in Metadata Cache
Requesting Gravatar...
great post. saved me a lot of time and headache
Left by sTEVE on Mar 02, 2010 5:00 AM

# re: Entity Typecode not found in Metadata Cache
Requesting Gravatar...
that has just save me a nervous breakdown. thankyou!
Left by sean r on Jun 24, 2010 12:11 PM

# re: Entity Typecode not found in Metadata Cache
Requesting Gravatar...
Was ready to kill someone - thanks!!! :-)
Left by RFish on Jul 04, 2010 3:03 AM

# re: Entity Typecode not found in Metadata Cache
Requesting Gravatar...
When ever your upgrading, you pretty much always find some sort of issue that has to be fixed manualy
Left by coloured contact lenses on Aug 04, 2010 7:40 AM

Your comment:
 (will show your gravatar)


Copyright © Wes Weeks | Powered by: GeeksWithBlogs.net