The most desired feature is ability to create/customize your own auto-number field. ANd CDS let’s your do just that!
I remember the good old days when I had to write a plugin to function for AutoNumber which used to configuration from a supposedly separate Configuration entity and it scary to maintain the code and entity. But this solves all that with so much ease!
Create an AutoNumber field in CDS
- Now, you can start by creating a field in CDS’ Solutions > [YourSolution]> [YourEntity]
- Then, under Accounts, you can see that you can actually create an Autonumber. This is not available in Classic UI.
Also, please note that you’ll need to keep this field Not Required and Locked (on the form) in order to function.
- Give it a suitable name and then you have 3 options to format your auto-number field.
String Prefixed numberYou’ll need to define the Prefix, Min Digits, Seed value
Date prefixed numberWith Date prefixed, you’ll need to define Date Format, Min Digits of Seed Value
CustomWith custom, you can define the Format. Refer Microsoft’s Documentation for the same – AutoNumberFormat options
Save and Publish as you usually would and place your field on the form you want.
I used String method to design my AutoNumber field. Let’s see how it looks –
Once I save the record, the Auto-number will be filled in.
If you happen to delete any records already created in the sequence, the auto-number functionality will continue counting upward and not fill out previous backlogs/last deleted auto-number records.
Hope this helps!