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 :
Customer experience | Sales, Customer Insights,...
Answered

Allowing duplicate on name field as Primary Key

(0) ShareShare
ReportReport
Posted on by 65

Hi, 

Currently I am getting duplicate record error when I try to create another record with the same name. In my table, name is  used as primary key. I cannot change the primary key from name to something else because there are already lots of other tables depending on this table. I also read in the forum that name field even if it's a primary key can be duplicated so not sure why I am getting the error. 

Can some please help me to resolve this issue? 

  

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Can you check if you have Alternate key defined for Name field?

    Also check if duplicate detention rule exist for you entity

  • Suggested answer
    XM-22040801-0 Profile Picture
    11 on at

    Hi,

    Your error message is due to an alternate key on the primary name of your entity.
    I explain below how to list the Alternate Keys.

    If needed, you can remove the alternate key.

    I also explain how to see the Duplicate Detection Rules below.

    Is it a custom entity ?

    Alternate key

    Navigate to Advanced settings => Settings => Customization => Customize System => Your entity => Alternate key.

    pastedimage1684743100088v2.png

    Duplicate Detection Rules

    You can customize the Duplicate Detection Rule in Advanced Settings => Settings => Data Management => Duplicate Detecton Rules.

    pastedimage1684743386166v1.png

    pastedimage1684743262074v4.png

  • Suggested answer
    ankit_singhal Profile Picture
    560 on at

    The primary key is GUID in CRM. You can check if there is any alternative key/Duplicate detection rule or any custom code is working on name

  • Prajwal Bhetwal Profile Picture
    65 on at

    Hey Bipin,

    I don't see any Alternate keys and also there is no duplicate detection rule for this entity.

    pastedimage1684797248244v2.png

  • Prajwal Bhetwal Profile Picture
    65 on at

    Hey Xavier,

    I don't see any Alternate keys and also there is no duplicate detection rule for this entity.

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Can you deactivate Alternate key on prefix_Name field which is visible on your screenshot and then try to create record with same name?

  • Prajwal Bhetwal Profile Picture
    65 on at

    That's the primary key, not the alternate key.

  • Suggested answer
    XM-22040801-0 Profile Picture
    11 on at

    Alternate Key = Keys in a solution, so you have an Alternate Key.

    The error you have comes from the presence of the Name line in Keys.

    If you don't want this Alternate Key, you could disable/remove the Name line.

    Remove this Alternate Key implies that the Name field will no longer be unique and that you could not access to a record of this entity with its Alternate Key in WebAPI.
    Do you know why this field was set as an Alternate Key ?

  • Prajwal Bhetwal Profile Picture
    65 on at

    Hi, thanks for your response. The key was added to primarily avoid the duplication of the same name.

    But my requirement is that if the same name is an inactive record then I must be able to create another record with another name. Deleting the key will fix one issue which is yes I can create another record with the same name. However, I also don't want duplicate ACTIVE records.

  • Suggested answer
    XM-22040801-0 Profile Picture
    11 on at

    Ok, the actual Alternate Key can't meet your needs.

    To meet your needs, you can either:

    1 .Create a Duplicate Detection Rule on Name field for Active records.
    2. Create Plugin that throw an exception when the record is active and a duplicate is found.

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans