Setyenv · Docs
  • English
  • Spanish
  • Chinese
  • Japanese
  • Arabic
  • German
  • French
  • Hindi
  • Indonesian
  • Italian
  • Dutch
  • Portuguese
  • Russian
  • Turkish

Auto-numbering

Auto-generate sequential reference numbers for records — like ticket numbers (INC-00042), order IDs, or case references.

Configuration

SettingDescription
PrefixText before the number (e.g., INC-, TICKET-, ORD-)
PaddingHow many digits, zero-padded (e.g., 5 → 00042)
Next valueThe next number to assign

The formatted output is stored in the record's pfm_number column.

Atomic allocation

Number allocation uses INSERT ... ON DUPLICATE KEY UPDATE with LAST_INSERT_ID() — this guarantees no two records get the same number, even under concurrent load.

Backfill

If you add auto-numbering to an existing entity:

POST /pfm/v1/meta/entities/{slug}/numbering/backfill

This assigns numbers to all existing records that don't have one yet.

Format stability

The format is captured at allocation time. If you later change the prefix or padding, existing records keep their original numbers. Only new records use the updated format.