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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

any way to query entity name by entity type code?

(0) ShareShare
ReportReport
Posted on by

Hello, I have a design that generically supports different types of entities. This design involves passing an ObjectTypeCode parameter as part of a request to a manager class.

So, for example, if a request with ObjectTypeCode = 112 is passed to the manager class then the manager class treats the request as an incident request because CRM defines an incident as having ObjectTypeCode 112.

I'm having problems using a QueryExpression for this. When I try to query "entity" or "entityview" through a QueryExpression, CRM returns the following error message:

The entity with a name = '[entityname]' was not found in the MetadataCache

Do you have any recommendations that I can follow to query an entity name by ObjectTypeCode?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    yes you can pass entity name in the object type code

    get object type code

    var objectTypeCode = Xrm.Page.context.getQueryStringParameters().etc

    window.open("/DNS/notes/edit.aspx?hideDesc=1&pId=" + recordid + "&pType="+objectTypeCode+"", "", "width=500,height=200");

    object type code by entity name

    var selectQuery = "AnnotationSet?$select=AnnotationId&$filter=IsDocument eq true and ObjectTypeCode eq 'dns_match' and ObjectId/Id eq guid'" + objectid + "'";

  • Community Member Profile Picture
    on at

    That's insightful.  Thanks Guido.

  • Community Member Profile Picture
    on at

    I decided to go with a parameter of entity name instead of object type code.  Since QueryExpressions use entity name, using entity name as a parameter seems like a reasonable approach, especially given the fact that custom entity object type codes are not guaranteed to be the same across environments.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans