Auto Number
Auto Number is a custom field type in Salesforce that automatically generates a unique, sequential number for each new record created on an object.
Definition
Auto Number is a custom field type in Salesforce that automatically generates a unique, sequential number for each new record created on an object. Administrators define the display format (such as a prefix and number of digits, like 'CASE-{0000}'), and Salesforce increments the number automatically. Auto Number fields are commonly used for Case numbers, Invoice numbers, and other identifiers that require unique sequential values.
In plain English
“Auto Number is a field type that generates a unique sequential number for every new record automatically. You've probably seen Case numbers like 00001234, 00001235. That's Auto Number doing its thing: incrementing the number by one every time a new record is created.”
Worked example
Riverbend Auto adds a custom Service_Ticket__c object for their service department. The Record Name is configured as Auto Number with format SVC-{0000} starting at 1. The first ticket created gets SVC-0001, the next SVC-0002, and so on. Service techs reference tickets by their auto-number ID over the radio ("working on SVC-1247"), customers see it on receipts, and the tickets sort cleanly by creation order in reports. Auto Number is the trivial, automatic alternative to humans typing identifiers - and unlike a manually-entered Name field, two service techs can't accidentally create tickets with the same number.
Why Auto Number matters
Auto Number is a custom field type on Salesforce objects that generates a unique, sequential value for each new record. When configuring an Auto Number field, administrators specify a display format (like CASE-{00000} which produces CASE-00001, CASE-00002, and so on) and a starting value. Salesforce then increments the number automatically whenever a new record is created, and the value is set once and cannot be changed afterward.
Auto Number fields are commonly used for human-readable identifiers like Case Numbers, Invoice Numbers, Project Codes, and Ticket IDs where users need a unique reference that's shorter and more memorable than a Salesforce record ID. One important thing to know: Auto Number sequences can have gaps when record creation fails mid-transaction or when records are deleted, so they should not be used as audit trails that require no gaps. For that, you need different patterns.
How to create Auto Number
Auto Number is a custom field type that generates a unique, sequential number for each new record — "INV-{0001}," "CASE-{0000000}," "PRJ-{0000}." Salesforce increments automatically; admins control the display format. Common for invoice numbers, ticket numbers, and any identifier that needs sequential uniqueness.
- Open Setup → Object Manager → [object] → Fields & Relationships → New
Auto Number is a field type, created the same way as any custom field.
- Pick Auto Number as the Data Type
From the field type picker. Auto Number is locked at field creation — you can't convert another type to Auto Number later.
- Set Display Format
Format string with {0} placeholders: 'INV-{0000}' produces INV-0001, INV-0002, etc. Leading zeros pad the number to the format width.
- Set Starting Number
Where the sequence starts. Default 1. Useful for migrations: pick a starting number above your existing data so new records don't collide.
- Set Field Label and Field Name
Standard custom field metadata.
- Tick External ID (optional but recommended)
Marks the field as searchable / unique-indexable. Useful if external systems use this number as a join key.
- Save
Field is created. New records get the next number automatically; existing records get NULL until you bulk-populate.
Required. Format string with {0} placeholder.
Required. Default 1.
Required. Same as any custom field.
- Auto Number fields don't populate retroactively. Existing records get NULL when you add the field — bulk-populate via Data Loader if needed (use a starting number high enough to avoid collisions with new records).
- Display Format is locked after Save. Switching from 'INV-{0000}' to 'INV-{00000}' (more digits) requires deleting and recreating — losing all existing values.
- Auto Number is text, not numeric. Sorting by auto number sorts alphabetically — INV-0010 sorts before INV-002 unless you pad with leading zeros.
How organizations use Auto Number
Uses Auto Number fields on a custom Invoice__c object with the format INV-{YYYY}-{0000}. Each invoice gets a year-prefixed sequential number that's easy for customers and AP staff to reference verbally.
Configured an Auto Number field as the primary display name for their Work Order custom object. Field technicians reference work orders by number in radio calls and paperwork, so a clean, unique identifier matters.
Learned the hard way that Auto Number gaps are expected. Their finance team raised an alarm when invoice numbers skipped from 1044 to 1046, but the missing number was just a cancelled save, not lost data.
Trust & references
Straight from the source - Salesforce's reference material on Auto Number.
- Creating an Auto Number FieldSalesforce Help
Test your knowledge
Q1. What does an Auto Number field do?
Q2. Can Auto Number sequences have gaps?
Q3. Which of these is a common use for Auto Number fields?
Discussion
Loading discussion…