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 / Alternate Key w/ Null ...
Power Apps
Unanswered

Alternate Key w/ Null values

(0) ShareShare
ReportReport
Posted on by 20

Hi,

 

For a model-driven app, I have an alternate key on a Dataverse entity comprised of 3 lookup columns, one of which is left null a majority of time. I still need to enforce uniqueness, which I've come to understand isn't supported for alternate keys.

 

My question is- has anyone out there found a workaround?

 

My only idea so far has been to default create a "Null" placeholder value in the problematic field.  This is not ideal for my current environment but will use as a last resort.

I have the same question (0)
  • AhmedSalih Profile Picture
    6,680 Moderator on at

    Hello, @KyleRichardson1, Alternate keys must be unique. If you have your Alternate Key from three Columns: A, B & C, you can’t have two exact combinations.

  • KyleRichardson1 Profile Picture
    20 on at

    @AhmedSalih Thank you for the response.

     

    Unfortunately, if there's a null value in any of the alternate key fields, it will not enforce uniqueness.

     

    For instance, if columns A, B, and C below are my key fields, it will allow the duplicate entry with null values in C, even though it should be recognized as a duplicate with the exact combination.

     

     Column AColumn BColumn C
    Record 1Lookup Value 123Lookup Value 456null
    Record 2Lookup Value 123Lookup Value 456null
  • AhmedSalih Profile Picture
    6,680 Moderator on at

    @KyleRichardson1, I see, the null value is not a value that can be tested against the Alternate Key. In this case your last resort is the only solution. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    An alternative approach is to create a string column on the table which contains a concatenation of all the other keys, including the nullable key, adding this to the keys, and making sure it is alway populated.

    So you could have end with a concatenated "key" of "00000000-0000-0000-0000-00000000000011111111-1111-1111-1111-11111111111122222222-2222-2222-2222-222222222222" when the nullable column isn't null, and a key of 33333333-3333-3333-3333-33333333333344444444-4444-4444-444444444444 when it is null.

    Hope this makes sense.

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

    don't make things complicated. As you already imagined, just create a lookup value called "NULL" and set the lookup to be required. (you can also set it as default value with some javascript so users don't need to select it manually if often the value should be this null)

    EDIT: sorry, didn't notice the thread was old

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 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard