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
AlexPHPAlexPHP 

Backfill an autonumber custom field to existing data

Is there a way to automatically backfill an autonumber on existing object records?

 

Or does this have to be done programmatically via APEX?

 

Thanks for your insight in advance.

Best Answer chosen by Admin (Salesforce Developers) 
flewellsflewells

This can be done if you temporarily change the field from autonumber format to text format.  Once it's text format, update your records en masse (i.e. Data Loader) with the appropriate numbering, then re-enable the autonumber field, making sure to set the starting number to pickup where you need it to.

All Answers

flewellsflewells

This can be done if you temporarily change the field from autonumber format to text format.  Once it's text format, update your records en masse (i.e. Data Loader) with the appropriate numbering, then re-enable the autonumber field, making sure to set the starting number to pickup where you need it to.

This was selected as the best answer
AlexPHPAlexPHP

Thanks, felwells.  I did just that with some anonymous APEX code to populate my existing records.

 

Was hoping there was an easier option, but oh well.

DownstairsBDownstairsB

I know this has been solved awhile ago but now there is a checkbox on the Auto-Number creation page, that lets you automatically back-fill existing records.