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)

Entity Table ObjectTypeCode

(0) ShareShare
ReportReport
Posted on by 390

Hi,

As a Dynamics crm user we cannot query the entity table directly in database nor there is filtered view for entity table like FilteredEntity. Is there any way to get the objecttypecode of the entity using sql query by an crm user?

*This post is locked for comments

I have the same question (0)
  • Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    Hi,
    You can get the objecttypecode from SQL using this code:

    SELECT ObjectTypeCode FROM Entity WHERE Name='account'

  • Jayakumar Profile Picture
    390 on at

    That is my actual issue. I am getting select permission denied Error on Entity Table. I am a dynamics crm user with Admin Role. Still I cannot retrieve the data from this table in database. I dont want to give explicit select permission in database level for this user. Is there any way?

  • Jayakumar Profile Picture
    390 on at

    Please note there is no filtered view for the Entity table else I would have able to retrieve it.

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    2,545 on at

    Hi Jaya,

    Querying the database directly is not supported in Dynamics 365. You can access the metadaservice to get entity-specific details and it is also possible to get the same using the correct source code of javascript. Please let us know the exact functionality you want to achieve so that I can share appropriate information.

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Another way you can probably get this is by querying the StringMap table:

    SELECT DISTINCT AttributeValue, Value FROM [StringMapBase]

    WHERE AttributeName = 'objecttypecode'

    ORDER BY Value

    Again, not supported, but you can get directly from SQL.

    I would suggest getting your data by querying the metadata using webapi.

    You can also get the metadata browser plugin from XrmToolbox if you need this:

    docs.microsoft.com/.../browse-your-metadata

    Hope this helps.

  • Inogic Profile Picture
    713 on at

    Hi,

    You can use the below SQL query to get the Object Type code.


    SQL Query:

    select Name, ObjectTypeCode from EntityView order by ObjectTypeCode

     

    And if you want to get the object type code using Web API then use below code:

     

    [org service root URL]/EntityDefinitions?$select=LogicalName,ObjectTypeCode

     

    You can get the service root URL from Developer resource area. For this, navigate to Settings àCustomizations à Developer Resources, as shown in below screenshot:

    Web-API.jpg

     

    Please mark as verified if the answer is helpful.

    Thanks!

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