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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Entity update with no natural key

(1) ShareShare
ReportReport
Posted on by 394
Hi,

There is table from a third party, that has an entity with Data management enabled as false.  (Also this table doesn't have a natural key).

So i was asked that we need to update a certain field via a data entity.

So i added this third party model to my model. I created a new entity with this table (i created the entity by a workaround to skip the natural key error that would come if i create the entity from the wizard).
 

Questions:
1. But now what would be the entity key? if I add recId, it means that people will need to add recId in order to update the field and i think it's not good to use recIds for importing.. or would that be the only option in my case?
2. Also can i only allow updates for fields for the entity and not allow inserting a new record?
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    297,205 Super User 2025 Season 2 on at
    Entity update with no natural key
    Hi Deldyn,
     
    You are correct that Record IDs shouldn't be used as entity key. It sounds like you found an alternative combination of fields. I would suggest test it carefully and monitor if this would be the correct entity key for your requirement.
  • DELDYN Profile Picture
    394 on at
    Entity update with no natural key
    Hi Andre,

    There is only one index with allow duplicate no for this table, which has two fields (RecId + Temporary).
    And I can't use RecId when importing as far as I know, as it's not a good practice, or would you have used RecId??

    So based on some analysis myself by looking at records values, I decided to put the following as Entity key (Invoice, InvoiceDate, Voucher, TransDate, VendAccount) -- I think this combination would somehow gurantee me a unique value even though it's not specified as an index in the table.
  • André Arnaud de Calavon Profile Picture
    297,205 Super User 2025 Season 2 on at
    Entity update with no natural key
    Hi Deldyn,
     
    As we don't know the contents of this table in your environment and we don't know the exact table structure, you are the only person who can check what combination of fields makes a unique record. Looking at the index provided by AXtension, it could be for sure that with any combination you will get duplicates based on one set of fields, or the other, or both.
    Does the table have another index that does not allow for duplicates? If that is the case, you can use that set of fields for the entity key.
  • DELDYN Profile Picture
    394 on at
    Entity update with no natural key
    Hi Martin,

    it's a table related to purch invoices. (Axtension module, table AXTip_PurchInvoice)
    the table unique index is (RecId and Temporary)

    I think I was able to find something unique which is TransDate  but i'm not sure

    so the following "Invoice, voucher, TransDate" looks unique as i checked SQL and i didn't find any duplicates but i don't know in the future what could happen.

    OR do i need to add vendAccount and DocumentDate(which is the invoiceDate) as well?

    so would the key be 
    Invoice, voucher, TransDate
    OR
    Invoice, voucher, TransDate, vendAccount, DocumentDate
  • Martin Dráb Profile Picture
    235,800 Most Valuable Professional on at
    Entity update with no natural key
    1. We don't know the table, therefore we can't tell you which field or a combination of fields uniquely identify a record. You'll need to do an analysis.
    2. Yes, it's possible. For example, you can throw an exception in insert() method of your data entity.

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 665 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 595 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 558

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans