Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Concurrency in with the field type 'Auto number'

Posted on by 10

Hi,

I am currently experiencing concurrency issues with a custom built auto number entity and came across this link: 

https://jonasr.app/2020/03/anm-unique-seq/

To my surprise the new UI offers a auto number data type, I am however a bit concerned how this data type handles concurrency issues. I have not been able to find any MS source explaining exactly how this field works, does it utilize SQLs built in auto number feature or how does it work?

I have a system with a high load from an external API and internal plugins creating transactions. It is very important that all transactions get a unique number and are not subject to any concurrency related exception as I am currently experiencing with the current, optimistic concurrency approach. This main issue is that the full database transaction is rolled back, which causes issues when sales are coming in from integrated systems.

Please let me know if you have came across similar issues and how these were handled. 

I cannot utilize the 'normal' auto number feature as the increments are different based on the customers brand etc. Meaning I would need some kind of plugin logic as described in the link above.   

  • aasdasd Profile Picture
    aasdasd 10 on at
    RE: Concurrency in with the field type 'Auto number'

    Hi Lu,

    Thanks you for your reply.

    Unfortunately the requirement for this formatting is that there is one character prefix with four numbers (ex T1111).  

    However, I tested the solution by running three instances of Visual Studio and creating 50 records/instance which seems to be working. This setup previously triggered my concurrency issues at least.

  • Suggested answer
    LuHao Profile Picture
    LuHao 40,872 on at
    RE: Concurrency in with the field type 'Auto number'

    Hi aasdasd,

    In order to solve the concurrency problem, we recommend that you set the format of all auto number fields to number + random string, which is also the format Microsoft uses for OOTB auto number fields (such as Quote ID).

    pastedimage1605147677157v1.png

    In fact, the mobile offline feature of D365 would cause concurrency, and they've devised a solution for this by using random strings to avoid the duplication of pure numbers, but it doesn't seem to be mentioned in the D365 documentation.

    When you create a autonumber field, select autonumber type to Custom, then select Add random string to format.

    You can change the number of character digits by changing the highlighted number.

    pastedimage1605148252579v2.png

    In this way, even if concurrency occurs and the number part is duplicated, the random string part will be different, thus avoiding the problem of duplicate values in the auto number fields.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans