cancel
Showing results for 
Search instead for 
Did you mean: 
Devvj

Reset or Change Autonumber-seed with Power Automate

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

 

Devvj_0-1699392414939.png

 

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

  • Frequency = "Year
  • Interval = 1

You can set the Time zone and Start time to a value that makes sense for you

Devvj_1-1699393550534.png

 

Then we just add a Dataverse action, named "Perform an unbound action" and add the following information

  • Action Name = "SetAutoNumberSeed"
  • EntityName = <Table name your field resides in> 
  • AttributeName = <Name of your field>
  • Value = <New Seed number> 

Devvj_2-1699393950924.png

 

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