Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

entity Key in Entity in D365FO

(1) ShareShare
ReportReport
Posted on by
Hi Team,
 
In Entity, We have Entity key.
 
 
I have few queries on this.
 
1. What the Entity key does?
2. While creating a new entity , then only we can mention the entity key? If yes, pls let me know the exact place where to put the entity key.
3. After creating an entity, for example  - Modifier Group Entity. We have an entity key -- MasterGroupName.
 
If I like to change the entity key ---
 
How we can change the entity key?
If I change the entity key, is it will impact in Entity?
 
 
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,661 Super User 2024 Season 2 on at
    entity Key in Entity in D365FO
    Hi @rp@n,
     
    I will try to explain it with an example, continuing on the words from Layan. Imagine, you want to import the next customers:
     
    CustAccount Name CustGroup CreditMax Language
    US-101 Forest Wholesales 30 10000 en-us
    US-102 Winter Wholesales 30 10000 en-us
    US-103 Contoso Manufactuing Italy  20 10000 en-us
    US-104 Funky Wholesales 30 10000 en-us
     
    The entity key should represent a unique natural key when you want to support import of data. If the entity key is CustAccount, it will have unique IDs and will import or update records correctly.
    In case the entity key is set to CustGroup, you can get the next import result, assuming the customers didn't exist yet.
     
    CustAccount Name CustGroup CreditMax Language
    US-103 Contoso Manufactuing Italy  20 10000 en-us
    US-104 Funky Wholesales 30 10000 en-us
     
    Result: inserted 2 rows and updated 2 rows. This is because the entity key is now the CustGroup, it will loop the source file (all rows) and search for existing records based on this field. You would understand that this is an incorrect behavior due to a wrong entity key.
     
     
     
     
     
  • Layan Jwei Profile Picture
    Layan Jwei 7,264 Super User 2024 Season 2 on at
    entity Key in Entity in D365FO
    Hi User,
     
    In other words, for example look at customer entity, the entity key is custAccount.
    So now, if you try to import through this is entity two fields custAccount and CustGroup. And in your imported file, you chose an existing custAccount in the system, then this will result to update the custAccount chosen with the new CustGroup in the file. However, if your import contained a new custAccount that didn't exist before, the this will cause an insert for the customer.
     
    What Andre was trying to say in the last sentence is, imagine you can change the entity key for the customer entity (you can't)
    And let's say you put the entity key as custGroup.
    When importing, this will cause and update for any exisiting custGroup in the system even though your import file contained a new custAccount. Which is wrong.
     
    In general the entity key suggested should be correct but you can change it. To able to decide the correct key, ask yourself based on what do you want the insert to happen and based on what you would like the update to occur.
     
    Thanks,
    Layan Jweihan
     
     
  • Community member Profile Picture
    Community member 16 on at
    entity Key in Entity in D365FO
    Thanks Andre for the update.
     
    I am talking about my custom entity.
     
    As per my understanding, if entity key required to change then better not to change it otherwise it will impact on existing data and also impact on import aswell.
     
    If absolutely required to change then we can go for new entity with the required key which required as per my business requirements. 
     
    Am I correct Andre. Pls confirm 
  • Suggested answer
    Kevin Xia Profile Picture
    Kevin Xia Microsoft Employee on at
    entity Key in Entity in D365FO
    Hi,
    In finance and operations entities can have one or more fields of various data types as the entity key. An entity key uniquely identifies a record in a finance and operations entity.  
    Changing the Entity key can have an impact on entity data. Since the Entity key is used to uniquely identify records, changing the Entity key for existing data could result in data conflicts or disruption of related dependencies. 
    Best regards,
    Kevin
  • @rp@n Profile Picture
    @rp@n on at
    entity Key in Entity in D365FO
    Thanks Andre for the quick response.
     
    As you said "When you change an entity key, the impact is that it will use different fields to determine if there is already an existing record or not. A wrong key could lead to e.g. having only one record inserted and 9 records updates when the source file contains 10 records."
     
    Sorry not understand.
     
    Kindly elaborate me pls.
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,661 Super User 2024 Season 2 on at
    entity Key in Entity in D365FO
    Hi @rp@n,
     
    The entity key is intended to find existing records while importing data. It will then know based on what field(s) it should search existing records to update. If it can't find an existing record, it will insert a new record.
    When you create a new entity in your own model, the entity key is suggested by the wizard. You can then change it if needed. You can't change entity keys of data entities belonging to the standard application. 
     
    When you change an entity key, the impact is that it will use different fields to determine if there is already an existing record or not. A wrong key could lead to e.g. having only one record inserted and 9 records updates when the source file contains 10 records.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans