Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Create Combination 2 P...
Finance forum
Suggested answer

Create Combination 2 Primary Keys

Posted on by 245

How can I create combination of 2 primary keys ? 

5287.1.png

In the case I use AllowDuplicate = No

Is there something wrong with that ? 

  • Rangga Pramana Profile Picture
    Rangga Pramana 245 on at
    RE: Create Combination 2 Primary Keys

    Yes I did

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Create Combination 2 Primary Keys

    You can have only one primary key in a table. This is set by the PrimaryIndex property of the table.

    You can however have multiple unique indexes.

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,274 on at
    RE: Create Combination 2 Primary Keys

    Hi Rangga Pramana,

    You can use index that has more than 2 filed as a primary key. The only issue with it  is that according to best practice Primary Key should have 1 field, so it could be used as foreign key in other tables, but it is only best practice. Ideally, you should create unique index (set AllowDuplicates = No)  that has 2 fields (or more) and set Primary Index to RecId or any other surrogate key. 

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Create Combination 2 Primary Keys

    Have you set your index as unique ? Meaning having set the "Allow Duplicates" Property to "No" ?

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,459 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,783 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans