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 / Autonumber not working...
Power Apps
Unanswered

Autonumber not working anymore

(0) ShareShare
ReportReport
Posted on by 7

Hi everybody,

 

In the dataverse, i have a table that uses an autonumber column as primary name column. It worked fine until now.

If I add a new value, I always get this error:

A record that has the attribute values id already exists. The entity key idkey requires that this set of attributes contains unique values.

 

If I add a new item and fill in the autonumber column (id) manually with a nonexisting number, it works fine.

I have the same question (0)
  • v-xiaochen-msft Profile Picture
    on at

    Hi @Olav ,

     

    Could you use pictures or some formulas to describe the problem you encountered?

    Have you created an Alternate Key for the table?

     

    Best Regards,
    Wearsky

  • v-xiaochen-msft Profile Picture
    on at

    Hi @Olav ,

     

    To make it easier to understand, please check this section.

    v-xiaochen-msft_0-1619085030274.png

    Its function is to prohibit adding records with duplicate values.

     

    If you want to add records with duplicate values, I suggest you delete the key.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

  • Olav Profile Picture
    7 on at

    Thank you for looking at my question.

    So, I have a table: "ExampleTable". This has a primary name column: "Id" with type autonumber. So each time the user adds a new record, the system should assign automatically the next number. "Id" is the selected column under keys.

     

    Doesn't work:
    Patch(ExampleTable, Defaults(ExampleTable));

     

    Does work (assuming 123 isn't in the table yet):
    Patch(ExampleTable, Defaults(ExampleTable), {Id: 123});

  • Verified answer
    Fubar Profile Picture
    8,338 Super User 2025 Season 2 on at

    Not sure what has gone wrong etc, but you probably need to look at your existing data and find the current largest one in the name field, and then on the autonumber definition reset the Seed value higher than that number.

     

    As it appears you are allowing data entry into the field it is possible that a number was manually added (or imported) that the autonumber sequence is now also generating the same number and your Alt Key has a uniqueness issue as you now have a duplicate.

    (note: autonumber does not look at the current entity for the next number, the actual sequence is held elsewhere)

  • v-xiaochen-msft Profile Picture
    on at

    Hi @Olav ,

     

    You still have not answered my question.

    Please tell me to troubleshoot the problem.

    Have you created an Alternate Key?

     

    Best Regards,
    Wearsky

  • Olav Profile Picture
    7 on at

    The "id" column is the key column. It looks like autonumber reset the next value to a random number. In this case, the next number was 1153, however, I've had elements with id already in 1190. So I put a new seed value in it and now it works again. I can continue working but I still don't know what caused the problem so that's a pity.

  • albatros Profile Picture
    10 on at

    I had the same issue and this helped me.

     

    For some reason, when I migrated my solution to another environment including the table definition, the seed for my column was reverted to the default value (1000), instead of the value that I've picked originally (1). In my case, this was causing a duplicated ID issue because the id 1000 existed already (I kept IDs 1-31 free for testing purposes).

    Hope this can help others too.

  • CU01082049-0 Profile Picture
    on at

    Thanks for the update @albatros.

     

    I recently came across a similar situation. All along I was creating records using a canvas app. Then when I used a Flow to create records, it decided to start from the default value of the autonumber column. Of course those values were already taken so it errored out. What I discovered is that if you use the Dataverse action "Add new row for a selected environment", the Flow resumes from the last autonumber.

     

    Hopefully this helps anyone with the same situation.

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