Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
Answered

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.

  • CU01082049-0 Profile Picture
    on at
    Re: Autonumber not working anymore

    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.

  • albatros Profile Picture
    10 on at
    Re: Autonumber not working anymore

    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.

  • Olav Profile Picture
    7 on at
    Re: Autonumber not working anymore

    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.

  • v-xiaochen-msft Profile Picture
    on at
    Re: Autonumber not working anymore

    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

  • Verified answer
    Fubar Profile Picture
    7,875 Super User 2025 Season 1 on at
    Re: Autonumber not working anymore

    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)

  • Olav Profile Picture
    7 on at
    Re: Autonumber not working anymore

    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});

  • v-xiaochen-msft Profile Picture
    on at
    Re: Autonumber not working anymore

    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.

     

  • v-xiaochen-msft Profile Picture
    on at
    Re: Autonumber not working anymore

    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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Microsoft Dataverse

#1
stampcoin Profile Picture

stampcoin 15

#2
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 9 Super User 2025 Season 1

Overall leaderboard

Featured topics