2

I have a strange issue with auto number skipping numbers. After the creation of the auto number field, and checking the 'Generate Auto Number for existing records' checkbox I've got inconsistent numbering of records (look at the screenshot). My steps:

  1. Inserted Contact records
  2. Deleted all those previously inserted records
  3. Inserted new batch of records
  4. Deleted auto number field to reset sequence, because new contacts' auto numbers started from the last number of the previous batch

Auto Number Field Screenshot

1 Answer 1

2

Yes, that is correct behavior. A few numbers are skipped due to numbers being used in some other contexts. For instance, if the last number in the organization is 100, then when writing a test, you create 5 records. Consequently, records with numbers 101-105 will be created in the test. Thus, when you create the next record in Salesforce, the number will be 106. Similarly, other records such as those failing insertion or undergoing rollback also cause the same issue.

Also, numbers assigned to deleted records are also not reassigned. So if you delete a record with number 100 that number will not be reassigned to any other record.

3
  • thank you for answer. I know about this behavior, but the strange thing is that for example CON0000001 number is assigned, but probably shouldn't because before reset I've deleted all contact records from org Mar 22 at 16:50
  • @RandomNickname23 Can you explain all the steps you followed? Its little confusing in Question. Can you update question and mention all the steps you followed 1 by 1 in order. Mar 22 at 17:35
  • Sorry for the not clear explanation, I've updated the question, and hopefully now it will be less confusing Mar 25 at 7:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .