Back in the old days, we had to write custom plugins to generate auto number to automatically assign sequential numbers to records being created for custom entities.
Earlier CRM had an option of assigning auto number for certain OOB entities(Like sales orders, Quote etc). For other systems & custom entities, we must write a plugin to get the auto number.
To overcome this issue of having to generate unique values always through custom code and to support the auto generation of a codes based on a given seed and format value, ‘AutoNumber’ data type was added in power platform.
Until now, the way to use new AutoNumber data type was to create a new field with the AutoNumber data type. This means, if you have been using a text field until now to store the auto-number generated through custom code and now want to switch to the in-built auto-number data type field, then you have to create a new one, you could not reuse the same field.
But now we have the option of changing the existing field data type (from string) to auto-number data type. Please see the illustration below:
Go to make.powerapps.com. Select the Entities under Data and select the entity you want to start the auto number process.
Select the field you want to change it to AutoNumber/ you can create a new field with the Auto number as data type.
Once you changed the DataType to Auto Number. You have to select the Format using the below options:
- String prefixed Number – You can decide your string.
- Date prefixed Number – will start the autonumber with date prefixed.
- Custom – You have option to decide your own way.
I am going to configure to show my auto number like PrefixedString-Currentyear-Numbersequence(BEG-2020-0001). Lets Start:
I choose custom as my autonumber type and write the below in format column
Seed Value is nothing but Starting value of the Autonumber. I select it as 1.
Click on done & Save once you have finished the configuration.
Create the record and you can see the auto number has been generated with the format you have selected.
That’s it. We can easily configure auto number even for custom entities without code by using a power platform.
Happy CRMing !!!!!!!!!!!!.
Published By – Bala Subramanian