Nowadays the standard Autonumber-field in Dataverse is actually quite functional, supporting a couple of formats that can be added in any order you want (a good learn article on the formats available can be found here: Create auto-number-attributes (Developer Guide for Dynamics 365 Customer Engagement (on-premises)) |...).
In the example below, I have created a new Autonumber-field for my Opportunity table, and set the format to follow this format: <Static String>-<Year>-<Seed Number>
OP-2023-0001
You might sometimes want to reset the seed-counter based on a given condition, may it be every new month or year for example.
There is a few options to reset the seed, I will show you have you do it easy in Power Automate using the SetAutonumberSeed Unbound Action.
Let's say we wish to reset the seed back to the original "0001"-seed every new year, this can be done in just 2 simple steps.
Start with setting up a Scheduled Flow and we set
You can set the Time zone and Start time to a value that makes sense for you
Then we just add a Dataverse action, named "Perform an unbound action" and add the following information
There, your done 🙂
When the flow runs, the counter will reset together with the year.
"OP-2023-0347" > "OP-2024-0001"
It really is the simplest thing and makes managing the autonumber-counters a little easier, atleast in some cases.
Thank you and see you next time!
/Viktor