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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Platform - Datav...
Power Apps
Unanswered

Power Platform - Dataverse

(0) ShareShare
ReportReport
Posted on by 9

Hi,

 

there seems to be conflicting information in documentation and community posts regarding Dataverse handling of unique keys at the database level.

I have created a table

- with a primary name column = Name

- with a key on Column = Code

I have set up a duplicate detection rule on Code column.

Using Powerapps or Dataverse form to enter data I can enter multiple records with the same code and also the same name

eg

Code=FONS; Name=AAA

First record saves as expected. On saving the second (and beyond) i get a message that a duplicate has been detected with an option to ignore. If I ignore I can store duplicate records in Dataverse.

Is this expected behaviour that I need to code around in PowerApps (and also APIs?).

thanks,

Jon

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    Duplicate Detection is designed to detect, not prevent the entry of duplicates.  But when you create a Dataverse table it will create a uniqueidentifier column (GUID) that will always uniquely identify that record.  You can also create a KEY column that will be unique for each record.  That column can have a variety of formats.  This is known as an alternate key.

  • ChrisPiasecki Profile Picture
    6,422 Most Valuable Professional on at

    Hi @JH_IC,

     

    @Pstork1 is correct in that a duplicate detection rule will prompt you of other potential duplicates but still give you the flexibility to save the duplicate as there may be valid reasons for having the duplicate.

     

    If you set up a (Alternate) Key on the column or combination of columns that should be unique, it will prevent the user from saving the duplicate and present an error back to the user. The error message will just tell you that a duplicate value exists. This is enforced at the Database level and so will be consistent across all user experiences and any integrations trying to write data into Dataverse. 

     

    If you want to prevent the duplicate being saved, I'd recommend using both a duplicate detection rule and a key for the best user experience, since the dup detection rule will prompt you with the record that has been identified and let's you easily navigate to it..

     

    ---
    Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

  • JH_IC Profile Picture
    9 on at

    Thanks for responses to date but I am not seeing unique constraint being enforced at database level. 

    I am attaching image of table columns, key and data (saved after ignoring the duplicate detection warning).

  • JH_IC Profile Picture
    9 on at

    Hi @ChrisPiasecki I have a key but it is not being enforced. See my uploaded images. Am I missing something?

    Thanks

  • Verified answer
    ChrisPiasecki Profile Picture
    6,422 Most Valuable Professional on at

    Hi @JH_IC,

     

    You'll have to clean up your duplicates before you can use an alternate key, as the database indexing job behind the scenes will fail due to to the duplicates.

     

    If you Switch to Classic interface, browse to your table and the keys and you will see an additional Status column for the key.

     

    When you first create the key it will be in a Pending status with a system job that creates the database index. This can take some time to complete depending on the number of records in your table. You can click on the job to see the status of that job, if and why it failed.

    ChrisPiasecki_0-1628535706297.png

     

    Once it is completed successfully then the status should change to Active as shown below. The system job gets cleaned up automatically.

    ChrisPiasecki_2-1628535816332.png

     

    ---
    Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

     

     

  • JH_IC Profile Picture
    9 on at

    Hi @ChrisPiasecki , thanks for that. Yes that is the issue. Tip for anyone else - you can switch to classic view via Solution Explorer. 

    Thanks,

    Jon

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard