+ Start a Discussion
Jeff TalbotJeff Talbot 

Need to generate an Auto Number in existing records - The Auto Number field already exists

A year ago, a prior administrator created a custom field 'Internal ID' in the Account object with a field type of Auto Number. However, he did not check the "Generate Auto Number for existing records" checkbox. As a result, I have 79 Account records with no Auto Number.


I need to get an Auto Number assigned to those 79 Accounts. The problem is that the option to "Generate Auto Number for existing records" only appears when the Auto Number field is first created.


I've seen a method described where you change the Auto Number field to text and then back to Auto Number. But the details of using that method are vague, and I can't tell if I will lose the Auto Numbers that are already assigned. I absolutely can not lose the Auto Number that has been generated for the other 40 thousand Accounts. If I lose the existing auto numbers, I can probably kiss my job goodbye.


Anyone have any suggestions? Thanks!


My 2 cents to it..


Import 79 new junk records into accounts.... use a SQL procedure to delete the newly created 79 ones.. and assign the new 79 Autonumbers generated to the old records which don't have them already...


Let us know if this works for u..



Jeff TalbotJeff Talbot

The first part of your solution would be necessary to keep the auto-number format in those 79 records consistant with the auto-number format in all other records, and to keep each auto-number unique. Good point.


But regarding second part of your solution: Auto-number fields can not be written to using the UI or the API. Perhaps I'm naive about what a SQL Procedure is. Before I try to investigate this further - are you absolutely certain that you can write to an auto-number field this way? I have not seen any indication anywhere that you can write to an auto-number field with any method.



Aashish MathurAashish Mathur
Follow steps of this Knowledge Article: https://help.salesforce.com/articleView?id=000322921&type=1&mode=1 (https://help.salesforce.com/articleView?id=000322921&type=1&mode=1)

In step 3, you can populate values for those 79 records and then proceed to next steps.