Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

how to recognize if a record belongs to which entity?

Posted on by 30

I have a collection of records from different entities. I want to find the field name which contains the unique identifier for the particular record belonging to any entity. 

Is there an API that can accept something like record type and return which is the unique identifier for that entity type?

Basically, I have to perform some kind of action based on unique identifier field of the entity?

  • Suggested answer
    Dishant Sharma Profile Picture
    Dishant Sharma 30 on at
    RE: how to recognize if a record belongs to which entity?

    Thank you so much for the reply. It actually solved my issue.

  • Verified answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    RE: how to recognize if a record belongs to which entity?

    Hi Dishant,

    Each definition entity type uses MetadataId as the unique identifier property, which it inherits from the MetadataBase EntityType

    https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/use-web-api-metadata 

    Because the MetadataId is the primary key for definition items, retrieving individual items follows the same pattern used to retrieve business data tables.

    GET /api/data/v9.0/EntityDefinitions(<Entity MetadataId>)

    Refer to the following link for more details:

    https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/retrieve-metadata-name-metadataid#retrieve-definition-items-by-metadataid 

  • Suggested answer
    XM-22040801-0 Profile Picture
    XM-22040801-0 11 on at
    RE: how to recognize if a record belongs to which entity?

    Hi,

    What language and king of application do you use?

    To get the PrimaryIdAttribute from the entity name, you can use this WebAPI request:

    /api/data/v9.1/EntityDefinitions(LogicalName='account')?$select=PrimaryIdAttribute

    To learn more, see: learn.microsoft.com/.../query-metadata-web-api

  • Dishant Sharma Profile Picture
    Dishant Sharma 30 on at
    RE: how to recognize if a record belongs to which entity?

    Thank you so much for the reply. Actually, this field is not available in all entities. I tried looking it up in the knowledge article entity, but couldn't find it. Is there any other way or particular field which is universal to all the tables for achieving the same thing?

  • Suggested answer
    BillurSamdancioglu Profile Picture
    BillurSamdancioglu 15,786 Most Valuable Professional on at
    RE: how to recognize if a record belongs to which entity?

    Hi,

    You may use dataareaid.

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans