We will learn to change or reset Auto-Number seed value using Power Automate flow. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Platform.
Autonumber columns are designed to automatically generate alphanumeric strings upon creation. Users have the flexibility to customize the format of these columns according to their preferences. The system then generates corresponding values during runtime, automatically populating the columns with the specified format. Autonumber columns might sound technical, but in simpler terms, they’re essentially text columns with extra features. Power Apps makes it easy by treating Autonumber as a specific kind of data in the Text category. However, it’s worth mentioning that the traditional solution explorer can’t handle the creation or management of autonumber columns.
Autonumber values are preselected by the database when the row is started. If a row is started but cancelled, the number it was assigned is not used. If, during this time, another row is completed with the next sequential number, gaps will be present in the autonumbering of rows.
What is a Seed in an Autonumber field?
The initial number used in the format of an autonumber column is known as the seed value. To demonstrate, if you want an autonumber column to produce entries like CRMCrate-1000, CRMCrate-1001, CRMCrate-1002, and so forth, the seed value you’d choose is 1000. This is the starting point for your number sequence. While autonumber columns typically start with a default seed value of 1000, you have the option to set a custom seed value if you prefer.
Important Note –
Setting the seed only changes the current number value for the specified attribute in the current environment. The seed value is not included in a solution when it’s imported in a different environment.
Changing or resetting an Autonumber field with Power Automate.
Autonumber seeds are created in an incremental ascending fashion, however we can develop business logic to reset or change the seeding value as per the requirement.
In our example, we have developed a business logic where the seed value is reset to ‘1000’ every month. For achieving this requirement, we have created a Power Automate flow with a recurring schedule trigger and a Dataverse unbound action called ‘SetAutoNumberSeed‘.
Dataverse Unbound Action ‘SetAutoNumberSeed ‘ –
This unbound action allows you to change the seed value of an Autonumber field in Dataverse table. Below are the parameters required by SetAutoNumberSeed action.
EntityName: Name of your Dataverse entity.
AttributeName: Name of your Autonumber field present in the Dataverse entity.
Value: Numeric seeding value.
Below table row data shows the result of seed resetting in Power Apps.
Thus, we learned to change or reset Auto-Number seed value using Power Automate.