Reference numbers that number themselves
An auto-number field gives every new record a reference like EQ-2026-00001 the moment it is saved. Nobody types it, nobody can change it, and nobody has to look up the last one used. We imported the Enquiries sample, saved a few enquiries, and changed the format halfway through.

An invoice number, a case number, a booking reference. Every business has one, and somebody always ends up keeping a list of "the last one we used". An auto-number field ends that: the platform gives each new record its number when it is saved.
We used the Enquiries sample from samples/solutions/mda-reference-numbers. Import it into an
environment and open Enquiries from the app list to follow along.
A new record has no number yet
Select New. The Reference box is already filled in, with Assigned on save:

There's nothing to type, and you couldn't if you tried: the box is read-only. Fill in the title and select Save:

EQ-2026-00001: the prefix, the year, and a counter padded to five digits.
The numbers in the list
We saved a few more:

There's no 00004 or 00005. We'd saved two test enquiries and deleted them, and a number is never given out twice. That's what makes it safe for two people to save at the same moment: each save draws the next number from the database's own counter, so they can't both get the same one. The price is gaps. If the law needs numbering without gaps, number the records in a process step instead.
The number can't be changed afterwards either. A form shows it read-only, and if a spreadsheet import or a script sends a value for it, the value is ignored.
(While we were here we fixed the list: after saving a new record and choosing the table again in the sidebar, the list didn't show the new row until you pressed Refresh. It does now.)
Where the format lives
Open the maker portal, the solution, the Enquiry table and Fields. The Type column shows the field's type and its format:

To add one of your own, select New, give it a name, and choose Auto-number as the data type. A Number format box appears, already filled in, with a preview of the first number underneath:

(This drawer offered Auto-number before the server would accept one: saving it was refused as an unsupported data type, so only an imported solution could carry the field. We fixed that, and checked that a record saved afterwards gets its number.)
Writing a format
Anything you type is kept as it is. Three kinds of token are replaced:
| Token | Becomes | Example |
|---|---|---|
{SEQ} |
The next number | 417 |
{SEQ:00000} |
The next number, padded with zeros to the number of zeros you wrote | 00417 |
{yyyy} / {yy} |
The year the record was created | 2026 / 26 |
{MM} / {dd} |
The month and day it was created | 09 / 05 |
The preview follows as you type:

Tokens are case-sensitive. Type {YYYY} and it isn't a token, so it stays in the number as written.
The preview shows you before any record does:

The date in a number is the day the record was created, in UTC and in the Gregorian calendar, whichever calendar the person saving it uses. A reference number is an identifier, and it mustn't depend on who is reading it.
Changing the format
Select Reference, then Edit, and change the format. We tried ENQ-{SEQ:000}:

The preview shows the shape with a 1 in it, and says the count carries on. (It used to say The first number will look like, on a field that had already given out seven. We changed the words.) Save, go back to the app and save a new enquiry:

ENQ-008: the new format, with the same counter carrying on. (Number 7 went to a test record we deleted.) The records that already had numbers keep them, because a reference somebody has already quoted mustn't change underneath them.
Notice the order, too. The list sorts the reference as text, so the new prefix lands after all the old ones. Choose your format before the first record if you can.
(Saving this edit is another thing we fixed. Changing only the format used to say Saved successfully and keep the old one.)
The counter stays in its environment
The field and its format travel with the solution. The count doesn't. Import the solution into
Production and its first enquiry is …-00001 there too, whatever Development had reached. Each
environment numbers its own records.
The field as the table stores it
An auto-number field is one line in the table's document, with its format beside it. The Reference field from the Enquiries sample:
{
"logicalName": "par_reference",
"displayName": "Reference",
"dataType": "AutoNumber",
"autoNumberFormat": "EQ-{yyyy}-{SEQ:00000}"
}
Behind it, the environment's database keeps a sequence, a counter that belongs to this one field and hands out each number exactly once, however many people save at the same moment. That is the whole reason the numbers can't collide: nothing in the platform reads "the last one" and adds one. The database does the counting, in one step.
What the record stores is the finished text, EQ-2026-00001, not the bare number. That is
deliberate. The finished reference is what a person reads out on the phone, what a customer types
into a search box and what a view sorts by. Storing it as text means a search for EQ-2026-00417
finds the record directly, with nothing to work out first.
The counter doesn't start again each year
{yyyy} puts the year in the number; it doesn't reset the counter. If the last enquiry of 2026 was
EQ-2026-00731, the first of 2027 is EQ-2027-00732. Each number is still unique and still in
order, and the year tells a reader roughly when it was raised.
If you want every year to start from 1, the auto-number field isn't the tool. Numbering like that is a rule about your business, and the place for it is a step that works the number out deliberately, in a process or a server rule, where the rule can be written down and tested.
Designing a format
A reference outlives everything else about a record, so it is worth a minute before the first one is handed out.
- Put the year before the counter, as
EQ-{yyyy}-{SEQ:00000}does. Sorted as text, the numbers then come out in order across years. - Pad the counter for the volume you expect. Five digits is a hundred thousand records before
the numbers get longer. A record that reaches a sixth digit still works, but it sorts before
00002as text, so pad generously. - Keep the prefix short and meaningful.
EQfor enquiries,INVfor invoices. Two tables with different prefixes can be told apart at a glance in an email. - Leave out what changes. A department code or a person's initials in the number becomes wrong the day the record moves to another department.
- Avoid characters people misread, such as a capital O next to zeros or a letter l beside ones.
The format can change later, as the steps above showed, and existing numbers stay as they were. But a list sorted by reference then shows the old shape and the new one in two runs, so a format chosen once is tidier.
Where the reference shows up
Once a table has a reference, it is worth putting it everywhere a person might look for the record.
- As the second line under the record's name, so a lookup to enquiries shows EQ-2026-00417 under each title. The Enquiries sample does this. A picture and a second line beside every record shows how to choose it.
- In the quick find view, so typing the reference into a lookup's search finds the record, for example when somebody links a call to an enquiry. Lookup views and quick find explains which fields a lookup searches.
- On printed documents. An invoice number belongs on the invoice, and a report prints it like any other field.
- On a portal, where a customer quotes it back to you. A support-ticket portal shows customers their own case numbers.
Reading the reference from a script
To a script, the reference is a text field like any other. A rule that sends a confirmation email after an enquiry is created can put the reference in the subject line:
var sent = sendEmail('par_mail_service', {
to: 'enquiries@example.com',
subject: `New enquiry ${getValue('par_reference')}`,
body: `${getValue('par_name')} has just been raised. Quote ${getValue('par_reference')} in any reply.`
});
The first argument names the mail service, an environment variable that says where messages go, so Development and Production can send through different services without changing the script.
The number is given when the record is written, so read it in a step that runs after the save, when the reference certainly exists. Plugin steps: before and after a save explains the difference, and Send an email from a script covers sending.
Imports and integrations
The platform always writes the reference itself. A spreadsheet import that has a Reference column creates its records with new numbers and ignores the column, and an integration that sends a value has it ignored in the same way. If you are moving records from an old system and their old numbers matter, keep them in a separate text field, such as Old reference, and let the new records take new numbers. Both then stay searchable.
Questions that come up
Can a table have two auto-number fields? Yes. Each has its own counter and its own format. It is rarely useful, though: two references for one record is one more thing to quote wrongly.
Can I start the count at 1000? Not with a setting. The counter starts at 1 in every environment.
If a number should look established, pad it with zeros, {SEQ:00000}, rather than starting high.
Can I give an existing table a reference? Yes. Add the auto-number field and every record created from then on gets a number. Records that already existed stay without one, because a number is given only when a record is created, never on a later edit. So add the field before the table fills up if you can.
Is the number assigned when somebody opens a new form? No, only when the record is saved. A form somebody opens and abandons uses no number, which is why Assigned on save is shown instead.
Can people search by just the counter, such as 417? In a lookup, yes, once the reference is in the table's quick find view: a lookup's search matches any of those columns that contains what you typed, so 417 finds EQ-2026-00417. In a list, the search box matches the title, so use Filter with Reference contains 417. Lookup views and quick find explains how a lookup's search matches.
Try it
Add an auto-number field to a table of your own with {yy}{MM}-{SEQ:0000}. Watch the preview,
save, and create a record: it gets this year and month, then 0001.
Next: no duplicates, no double bookings, for the numbers and codes people type themselves.