function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ESTEST 

Is there a way to programmatically set the starting number of an autonumber field?

I've discovered that creating an autonumber field that resets the sequential portion after the year changes is not possible.  Accomplishing this, in general, seems non-trivial.

 

I think I have a way around it, though.  What if I were to create a method on an Apex class that runs under the Apex Scheduler at the beginning of each year that programmatically resets the starting number of an autonumber field?

 

Can the starting number be set programmatically?  I read elsewhere on the Discussion Boards where one has to change the autonumber field to a text field, and then back to an autonumber field with the new starting number.  If the year is part of the autonumber's format, this should avoid the uniqueness issue.

 

Is all of this possible?

 

Thank you.

NaishadhNaishadh
there is no way to make changes in auto number field value.