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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

New Natural Key on Cust and Vend Transaction Tables for incremental data entity push

(0) ShareShare
ReportReport
Posted on by 110

hi. A quick summary of my situation: (using D365FO (Update 7) environment).

Trying to create some data entities on transaction tables (cust/vend trans), to push data incrementally out.

This currently can’t happen because no natural key (those tables use recid which being a system fields isn’t allowed).

Workaround devised:

  • New field created (int64)
  • Clone recid value into that new field with SQL script (+ job) to populate field with recid.
  • Make new index using that new field.
  • Make index unique. (synchs fine after above script run)
  • Make tables primary index the new index
  • For new table entries (inserted records) - Class created with oninserted DataEventHandler similar as below:

    [DataEventHandler(tableStr(VendTrans), DataEventType::Inserted)]
    public static void VendTrans_onInserted(Common sender, DataEventArgs e)
    {

        // code to update new index field with recid.
    }

This works in the most part, but there are certain situations where duplicate key violations happen. For example, one scenario is probably that the Insert method is bypassed (a doinsert?). 

My question - Any ideas where else needs to be altered so that no violations of the index will happen - so that every time a new records is created a unique value is populated into it. It doesn’t matter if its recid or just an incremental number sequence really, as long as its unique so that change tracking will work.

As stated above, its mainly the custtrans, vendtran and taxtrans tables that are the problem.

thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Moiza Profile Picture
    21 on at

    Hi,

    This way works fine for me:

    Create a entity with CustTable/VendTable (accountNum as natural key default) and after that include the CustTrans/VendTrans on data source.

  • Martin Dráb Profile Picture
    239,399 Most Valuable Professional on at

    Can you elaborate why it "can’t happen"?

    There is a limitation of the data entity wizard; if this is the only problem, design the entity manually (duplicate an existing entity, remove everything from it and then design your entity from scratch). It will be much easier than your suggestion.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans