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 :
Dynamics 365 Community / Forums / Finance forum / what does the Alternat...
Finance forum

what does the Alternate key property in Indexes mean?

(0) ShareShare
ReportReport
Posted on by 1,552

I can see two indexes in table x. First one is allow duplicate no with alternate key no. The other one is allow duplicate no with alternate key YES. What is the difference?

  • Jie G Profile Picture
    Microsoft Employee on at

    Hello,

    Each alternate key relies on a unique index for its implementation and enforcement. However, a unique index alone does not make an alternate key. The AlternateKey property must be set to Yes to make a unique index be an alternate key, so that other tables can create foreign key relations that reference this key, as an alternative to referencing the primary key.

    If you set the AlternateKey property of an index set to Yes, it can be choosen as a replacement key.

    A replacement key is an alternate key that the system can display on forms instead of a meaningless numeric primary key value. Each table can have a maximum of one replacement key.

    The drop-down list contains every index that has its AlternateKey property set to Yes.

    Please refer this topic for more details: docs.microsoft.com/.../table-keys-surrogate-alternate-replacement-primary-and-foreign

  • junior AX Profile Picture
    1,552 on at

    Hii Ada,

    But i can create an index idx for table x with alternate key no then go to table y and make relation with the field in idx.. Isn't that as well considered as foreign key?

    And for the replacement key what do you mean it can be displayed on forms instead of primary? Can you give me an example

  • Verified answer
    Jie G Profile Picture
    Microsoft Employee on at

    Hi,

    Here are the answers for you:

    But i can create an index idx for table x with alternate key no then go to table y and make relation with the field in idx.. Isn't that as well considered as foreign key?

    Yes, it is as well considered a foreign key. In AX, an AOT node under MyTable > Relations represents a foreign key.

    And for the replacement key what do you mean it can be displayed on forms instead of primary? Can you give me an example

    Here is a practical scenario like how you can use replacement key and the benefit of having that property in tables:  community.dynamics.com/.../table-keys-replacement-key-in-ax-2012

  • Verified answer
    nmaenpaa Profile Picture
    101,172 Moderator on at
  • Sangram Shinde Profile Picture
    2,120 on at
  • junior AX Profile Picture
    1,552 on at

    Ada, it seems in D365 the foreign key doesn't create a field automatically like AX 2012.

    Thank you for the information :D

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans