Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

How can I prevent duplicate 'Account Numbers'?

Posted on by 25

We have a custom script that creates account numbers on our contact entity. The issue I am running into is that there is nothing to stop a system user (think website account creation) and a user generated account creation from happening at the same time. 

Question 1. Is there a way to force(?)/ implement a datetime that includes seconds on the system level?

Question 2. barring this (q1), would anyone have a mechanism that would allow me to create multiple contacts nearly simultaneously, but not delay the end user experience by artificially delaying their buying process for a minute. 

TIA

  • Suggested answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at
  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Moderator on at
    RE: How can I prevent duplicate 'Account Numbers'?

    Hi DFCPSA,

    1. The answer to Question 1#: As per the thread: community.dynamics.com/.../save-seconds-on-datetime-field, No.
    2. The answer to Question 2#: It is difficult to answer. Can you please elaborate on it a little bit more?

    To prevent duplication. You should need to follow these steps:

    1. Create a key for the column in the table. For more details: 
      1. https://learn.microsoft.com/en-us/power-apps/developer/data-platform/define-alternate-keys-entity
      2. https://learn.microsoft.com/en-us/power-apps/maker/data-platform/define-alternate-keys-reference-records
    2. Try to solve your problem with the auto number type column if it is failed then adopt the extension
      1. Use random or sequence numbers at the end of your format. In case of an extension or custom logic. Use a bridge table when the sequence number is your choice to store the previous number or the next number.

  • Suggested answer
    NODAL Profile Picture
    NODAL 860 on at
    RE: How can I prevent duplicate 'Account Numbers'?

    Hi DFCPSA,

    So basically, your auto number field on Account consists of date values and creation of multiple accounts at same time is creating accounts with duplicate numbers.

    You can instead create/convert your auto number field to an Auto number attribute and apply different formats.

    Autonumber: Autonumber columns in Microsoft Dataverse - Power Apps | Microsoft Learn

    Formats: Create auto-number-attributes (Developer Guide for Dynamics 365 Customer Engagement (on-premises)) | Microsoft Learn

    Community Tool Xrmtoolbox:  Auto Number attributes in Microsoft Dynamics 365 ⋆ JonasR.app - the Trenches

    Thanks,

    Ketan

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans