An Auto-Number field generates a unique sequential number on record creation, formatted by a display mask: OPP-{0000} produces OPP-0001, OPP-0002, etc. The next number is stored on the field metadata and increments per insert.
What admins watch for:
- You can't roll back the counter in production. If you mass-import 50,000 test records and then delete them, the counter has still incremented — your next real record will be
OPP-50001. Reset is a one-way street. - Sandbox refresh copies the counter from production, so test imports in sandbox don't pollute production numbers — but failed sandbox loads still consume sandbox numbers, which can confuse UAT.
- Format changes — when you change the mask (e.g.,
OPP-{0000}toOPP-{00000}), Salesforce re-applies the new format only to new records. Existing records keep their old format. SoOPP-00050andOPP-051could coexist. To re-format historical records you need a one-off Data Loader update. - Auto-Number is not a primary key. It's just a display value. Salesforce's
Idfield is the actual unique identifier. Don't use Auto-Number for joins or lookups — use Id or an External ID custom field. - You can manually reset the counter via Setup or a developer action — but it's destructive and rare. Use only after a clean-up where you've verified there are no lingering records.
