RecId

From Axaptapedia
Jump to: navigation, search

Introduction[edit]

The RecId is a unique field in every table, used as an identifier. Every row in the system, for a particular table, can be guaranteed to have a unique RecId. RecIds can be negative, and their value can change due import/export operations. Due to this, it was previously not considered best practice to use RecIds as foreign key references to other tables. However since the introduction of Dynamics Ax 2012, RecIds are used extensively (as so-called surrogate keys) as unique row identifiers.


If RecId corruption occurs, the SysRecIdRepair can be used to corect the problems. Axapta uses SystemSequences table to store urrent value of RecID (see http://www.eggheadcafe.com/forumarchives/axaptaprogramming/Aug2005/post23243136.asp)

Use in Dynamics Ax 2012[edit]

With the release of Ax 2012, the RecId gains a new importance. The recommended primary key for a table is now the RecId, and the correct foreign key to use to link to a table record is therefore that RecId. This is known as a Surrogate key.