Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to set Primary key to User field in Table

Posted on by Microsoft Employee

Hello Buddies,

        In Dynamics Ax, I want to set Primary key for particular field in User defined Table, As far as SQL concern, we could easily set Primary key. But, I couldn't set Primary key to particular field in easy way.

 

I hope you tat understand my question...

Thanks

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to set Primary key to User field in Table

    1) Create the Table and add required fields to the table as you all knows.

    2) Create an Index by dragging the required field to the Index.

    3) Set the following Index properties:

           a) AllowDuplicates to "no".

           b) Alternate key to "yes".

    4) Set the  Primary Index  property of the table to newly created index after creating the Index.

    5) For applying auto-increment you will have to use number sequence.

  • Jason Reck Profile Picture
    Jason Reck 50 on at
    Re: Re: Re: How to set Primary key to User field in Table

    Index is the correct solution for the table. You first will need to create an index with your respecitve fields that you want to be the primary index and set the index properties in the AOT to 'allow duplicates' = no. Once that is done, any indexes with that property set will show up in the PrimaryIndex drop down for the general table properties.

  • Kiran Vaswani Profile Picture
    Kiran Vaswani 465 on at
    Re: Re: Re: How to set Primary key to User field in Table

    Hello,

    Just check this out before rejecting index.

    http://msdn.microsoft.com/en-us/library/bb278358(AX.10).aspx

    After reading this if you think you can use index then please also set 2 more properties of your field.

    Mandetory = Yes and AllowEdit = No

    Thanks. 

     

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: Re: How to set Primary key to User field in Table

    I want to set primary key for specific field in table rather using 'RecID'.. Also, Index is not given correct solution..

    Thanks for ur consideration

  • Kiran Vaswani Profile Picture
    Kiran Vaswani 465 on at
    Re: How to set Primary key to User field in Table
    Hello,         Dynamics ax itself maintains a "RecId" field in every table for Id and also you can make a field primary.- In table node there is Indexes node- Just create a new index and Drag and drop you field there.- Set the AllowDuplicates property to "No"Thanks.  

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans