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

Community site session details

Session Id : 48HkpDYgGF/c/nJZGdiefy
Power Apps - Microsoft Dataverse
Answered

Add unique constraint to column in Dataverse Table

Like (0) ShareShare
ReportReport
Posted on 28 May 2024 12:32:34 by

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.

  • Hagru Profile Picture
    on 28 May 2024 at 13:00:52
    Re: Add unique constraint to column in Dataverse Table

    Perfect, thank you!

  • Guido Preite Profile Picture
    1,488 Super User 2024 Season 1 on 28 May 2024 at 12:59:40
    Re: Add unique constraint to column in Dataverse Table

    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
    on 28 May 2024 at 12:58:13
    Re: Add unique constraint to column in Dataverse Table

    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,488 Super User 2024 Season 1 on 28 May 2024 at 12:55:17
    Re: Add unique constraint to column in Dataverse Table

    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
    on 28 May 2024 at 12:53:02
    Re: Add unique constraint to column in Dataverse Table

    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?

  • Verified answer
    Guido Preite Profile Picture
    1,488 Super User 2024 Season 1 on 28 May 2024 at 12:35:23
    Re: Add unique constraint to column in Dataverse Table

    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

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Featured topics

Loading complete