Alternate key & Replacement key - Song Nghia - Microsoft Dynamics 365 Vietnam

Song Nghia - Microsoft Dynamics 365 Vietnam

Microsoft Dynamics AX/365 Outsourcing Service

Breaking

Thursday, May 2, 2019

Alternate key & Replacement key

Alternate key & Replacement key


The standard application is full of practical and real-life examples. One of them is HcmWorker table. The primary key of this table is the surrogate key, i.e. RecId.
But it also has two unique keys, that could be used as the primary key, therefore they're alternate keys.
One of them, HcmWorker_AX2, contains a human-readable value, namely the personnel number. That's a good choice when we want to display something to users, allow them to select a worker from a lookup and so on. Working with the primary key, RecId, wouldn't make sense, so we set HcmWorker_AX2 as the replacement key, and it will be automatically used by reference group controls.