Skip to main content

Notifications

Community site session details

Community site session details

Session Id : NYOLUaOWBYDVY7Hc0jbRFB
Power Apps - Microsoft Dataverse
Unanswered

Avoid duplicates in Name column Dataverse

Like (0) ShareShare
ReportReport
Posted on 26 Jan 2024 16:50:16 by 2,278

When creating a table in dataverse, the column "Name" was generated automatically as autonumber.

 

Now, I'm surprised that when entering data into this "Name" column with a form in Power Apps, it allows for duplicates!

 

What is the best praxis to prevent duplicates in a Name column, other than adding an alternate key, when submitting data through a Power Apps form?

 

In the form there is no "Update" property for the "Name" field.

  • Ethan_009 Profile Picture
    4,838 Super User 2025 Season 1 on 01 Jul 2024 at 04:41:45
    Re: Avoid duplicates in Name column Dataverse

    Hi @WebPortal ,

     

    Instead of enforcing restrictions on PowerApps, I'll suggest you try Duplicate Detection Rules in Dataverse/CRM for the table including the columns you want to keep it unique. 

    Another way is, if trying from PowerApps then find the value before performing SubmitForm or Patch operation. This will keep duplicates away most of the time, it may fail only is there's very large amount of data after filteration.

     

    Although, you can also hide the field on PowerApps form so users do not enter value in it or keep read-only on PowerApps level. 

    Lastly, Plugins is a solution but I think above solutions could help you prevent duplicates.

     

    Hope this helps

  • WebPortal Profile Picture
    2,278 on 30 Jun 2024 at 17:02:52
    Re: Avoid duplicates in Name column Dataverse

    Hello @Fubar @Ethan_R @a33ik 

     

    This is happening again, and I'm getting crazy.

     

    I have an alternate key that prevents the duplicates, but when users try to submit a new entry through a Power Apps Form, they see the marvelous message:

     

    "Network error when using Patch function. Value must be between 0 and 100." 

     

    Which is completely stupid.

     

    The error is caused because a duplicate entry on the primary column is happening and the alternate key does not let it in.

     

    On the form, there is no "Update" property for this field, so I can't even find the maximum value and add 1.

     

    How can I fix this? I don't know how to make the field "read only" nor how to create plugins.

  • Fubar Profile Picture
    7,852 Super User 2025 Season 1 on 28 Jan 2024 at 22:49:53
    Re: Avoid duplicates in Name column Dataverse

    On the forms that are being used make the field readonly. (in the old days these used to be readonly by default but was changed a number of years ago to allow them to be editable)

     


    @WebPortal wrote:

     

    The whole point here is why is it allowing duplicates?

     

    It seems to be correctly configured.


    The sequence number of the Autonumber is maintained by the system but not in the table that you have set it for. It does not look at any existing value that may be stored in your table when it generates the next number, just gets the next number from the system.

    The Autonumber is then populated in a text field, after which you can edit it.

    You can also get duplicates if you change the seed value in the autonumber definition to a number that is lower or the same as one that has already been generated.

    To guarantee uniqueness, you create an Alternate Key,

    To warn users who may still then choose to progress you create a Duplicate Detection Rule

    To stop someone editing the value you either don't have the field on the form (if its the Primary Name column you can make that field not business required and then remove it from the form) or make it readonly on the form.

     

     

     

  • WebPortal Profile Picture
    2,278 on 27 Jan 2024 at 18:12:02
    Re: Avoid duplicates in Name column Dataverse

    Hello,

     

    This is the field definition:

    WebPortal_0-1706378930928.png

     

    WebPortal_1-1706378949544.png

     

     

    WebPortal_2-1706378999295.png

     

     

    The whole point here is why is it allowing duplicates?

     

    It seems to be correctly configured.

  • Ethan_009 Profile Picture
    4,838 Super User 2025 Season 1 on 27 Jan 2024 at 16:46:19
    Re: Avoid duplicates in Name column Dataverse

    Wait @WebPortal ,

     

    Isn't AutoNumber field read-only? If not, prevent from editing by making field read-only so system can generate auto number on its own.

    It's strange that you can edit those and have duplicates.

     

    Also, as @a33ik  said Duplicate Detection rules can be used for instant validation without using Plugins.

    Alternatively, Plugins work as good as detection rules when used in sync mode. Plugin is beneficial for generating custom auto-number.

    Another way (may not be as great) while you are saving record in powerapps, check for that number and if duplicate then stop creating record else create.

     

     

    Hope this helps 

     

  • a33ik Profile Picture
    3,304 Most Valuable Professional on 26 Jan 2024 at 23:01:12
    Re: Avoid duplicates in Name column Dataverse

    That's correct. Then there are a few things you can consider:

    1. Create a Duplicate Detection Rule and Periodically run a Duplicate Detection Job to find those duplicates (that's weird that those even appear, actually it shouldn't happen - I would recommend checking how it's even possible). Here are a few articles about duplicate detection - https://learn.microsoft.com/en-us/power-platform/admin/set-up-duplicate-detection-rules-keep-data-clean and https://learn.microsoft.com/en-us/power-platform/admin/run-bulk-system-jobs-detect-duplicate-records
    2. You can tweak autonumber format to add a random string to the generated number to make it unique - https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/create-auto-number-attributes?view=op-9-1#autonumberformat-options
  • WebPortal Profile Picture
    2,278 on 26 Jan 2024 at 22:46:34
    Re: Avoid duplicates in Name column Dataverse

    Sure, but if it is autonumber, the user has no way of choosing a different number.

    I don't see the point of this column and don't understand what it is meant for.

  • a33ik Profile Picture
    3,304 Most Valuable Professional on 26 Jan 2024 at 21:10:09
    Re: Avoid duplicates in Name column Dataverse

    Ok, then the only way I see doable - allow to create the record but mark it as duplicate or do a check before the record is created and notify a user about the potential duplicate.

  • WebPortal Profile Picture
    2,278 on 26 Jan 2024 at 19:36:55
    Re: Avoid duplicates in Name column Dataverse

    @a33ik 

    It's not an option because when a user submits the form, sees an error message (the AK blocks the duplicates) and the record doesn't go through.

  • a33ik Profile Picture
    3,304 Most Valuable Professional on 26 Jan 2024 at 19:18:27
    Re: Avoid duplicates in Name column Dataverse

    Hello,

    Just curious why Alternate Key is not an option for you. If not Alternate Key you would have to create a Plugin to avoid Duplicates.

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
SadFox Profile Picture

SadFox 2

#1
CU06052020-0 Profile Picture

CU06052020-0 2

#1
stampcoin Profile Picture

stampcoin 2

Overall leaderboard

Featured topics