Hello readers. In this article, I am going to explain few facts about Dynamics 365 auto-numbering feature. Previously we had to write some SDK code to generate the auto numbering for custom entities. But after version 9.X, this is possible for any entity. I have been commissioned to find solution to replace the custom written auto numbering solution. From the team, this came up and had the opportunity to explore it more. You can find more details about this feature from the following link.
As of now, there is no interface help through Dynamics 365. But there is this nice XRM ToolBox plugin called Auto Number Manager by Jonas Rapp.
There are so many articles about this feature, but here I am going to list down few important facts I have encountered while doing the R&D work.
If you are using the Auto Numbering Manager, you can create a new auto numbering field or you can promote an existing field as an auto number field.
This auto-number feature will be included in the solution deployment, solution patches, and solution upgrades.
But unfortunately, it will not include the seed which you configured at the source environment. When you are deploying it to the destination, you must set the seed otherwise it will start with some random seed. Remember, when setting the seed, it must be the next number to be generated in the sequence. Also when promoting an existing field as an auto-number, you must take extra precautions to make the number is unique. For instance, you must ensure you are not entering an existing number as the seed.
The next scenario is when you have created new field for an entity which already have records at the destination. The cool thing about this feature is it will automatically fill up the auto-number field for out of the box entities such as Account, Contact, Lead, etc. But for custom entities, this is not possible.Best thing to do is to write an on-demand custom workflow or a console application that which will update the existing records.
Important: In such scenarios, you must first update the existing records with the preferred format and then update the seed of auto number with the next number to be generated at the destination.
If you are willing to write code, then you can write a plugin using the SDK to create or update an existing field as an auto number.
Also, most importantly, if you are deleting an existing auto number field, all data in the field will be deleted.
This is a cool feature, but I highly recommend that you should do little bit of playing around and make sure this fits to your exact need.