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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add unique constraint ...
Power Apps
Answered

Add unique constraint to column in Dataverse Table

(0) ShareShare
ReportReport
Posted on by 8

Hello!

 

I would like to add a Unique constraint to a custom column in my Contact table. The reason I want to do this is because they will have their own Customer ID coming from another system through an integration, and we don't want to create new contacts with the same Customer ID as another already existing Contact.

 

The custom field I would like to add this constraint to is a "Whole number", and I would like it to stay that way.

I have the same question (1)
  • Verified answer
    Guido Preite Profile Picture
    1,490 Super User 2024 Season 1 on at

    You just need to create an Alternate Key https://learn.microsoft.com/en-us/power-apps/maker/data-platform/define-alternate-keys-portal

     

    in this way you will not have duplicates in the column you defined as alternate key

  • Hagru Profile Picture
    8 on at

    Hi @GuidoPreite !

    So just by creating a new key, selecting the column, and give it a name, I will make a unique constraint to that column?

  • Guido Preite Profile Picture
    1,490 Super User 2024 Season 1 on at

    yes, that is the purpose of alternate keys, to ensure a set of fields (1 or more than 1) is unique, just as warning, make sure the column you are choosing for the alternate key doesn't have already duplicates or the alternate key will not be activated.

  • Hagru Profile Picture
    8 on at

    Perfect! Thank you very much, I will keep that in mind and check for already duplicate instances.

    One last thing, as it is not a required field, and a lot of the contacts won't have data in the field, will it stop me from creating multiple contacts with that field being empty?

  • Guido Preite Profile Picture
    1,490 Super User 2024 Season 1 on at

    empty is not considered a unique value for Alternate Keys, so you can have multiple rows with an empty value, but when filled they will be unique.

  • Hagru Profile Picture
    8 on at

    Perfect, thank you!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard