Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Entity Table ObjectTypeCode

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

  • Inogic Profile Picture
    Inogic 24,094 on at
    RE: Entity Table ObjectTypeCode

    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!

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Entity Table ObjectTypeCode

    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.

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    Kalpavruksh D365 CoE 2,545 on at
    RE: Entity Table ObjectTypeCode

    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.

  • Jayakumar Profile Picture
    Jayakumar 390 on at
    RE: Entity Table ObjectTypeCode

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

  • Jayakumar Profile Picture
    Jayakumar 390 on at
    RE: Entity Table ObjectTypeCode

    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?

  • Temmy Wahyu Raharjo Profile Picture
    Temmy Wahyu Raharjo 2,914 on at
    RE: Entity Table ObjectTypeCode

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

    SELECT ObjectTypeCode FROM Entity WHERE Name='account'

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans