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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Primary Key as combination of two fields

(0) ShareShare
ReportReport
Posted on by 3,945

Hi All,

we have a customized table containing two fields , one is of string type and second is int64.
In first field user is going to enter value and second field we are storing the recId of one related Table.
Our requirement is that , combination of both field value should not repeat.

Kindly suggest, how to achieve this 

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Create a unique index with these two fields. It doesn't mean that it must be a primary key - in fact, you should normally use the surrogate key as the primary key, but you can have any number of additional unique indexes.

  • Gautam Profile Picture
    3,945 on at

    Hi Martin, I have created a index with these two fields and "Allow Duplicate" - "No" i have given , but its throwing error even when one field value is similar to any record , its not checking the both field value.  

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    I don't believe that you've just found a critical bug in AX that nobody else have run into, therefore I assume that you're not testing it right. Please review your data in table browser; you probably have a conflict with records that you're not aware of.

    If you don't find anything, show us your specific implementation, data you're using and the exact error message.

  • Community Member Profile Picture
    on at

    hi martin,

     i m facing the same problem

    i have created index with 2 fields (enum and string)

    where i set allow duplicates no and alternate key yes

    enum values 0- pay 1- receive

    when i insert data  "pay id1"

    and m inserting data "receive id1" its throwing error that data already exists.

  • Community Member Profile Picture
    on at

    hi martin ,

    i got the answer

  • athombare Profile Picture
    135 on at

    @kasthu

    what was the issue because I'm facing the same issue

  • sivakarthk Profile Picture
    10 on at

    Hi,

    Any heads up on this?

    Thanks in advance.

    Regards,

    Siva 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans