Skip to content

ID

The autogen setting can be used on the ID field to automatically generate IDs from other field values. When used on the ID field, the generated value is automatically slugified (lowercased, spaces replaced with hyphens, special characters removed).

For using autogen on non-ID fields (text, textarea, etc.), see the All Field Settings documentation.

{
"autogen" : "${title}-${now}"
}

By default, the ID field slugifies input using hyphens as the separator (Draft Postdraft-post). Schemas can opt into underscore separators by setting snakeCase: true under the field’s settings:

{
"snakeCase" : true
}

With snakeCase: true, Draft Post slugifies to draft_post instead of draft-post. The same transform applies on both sides of the form:

  • Client-side — the form’s identifier field auto-slugs to underscores as the operator types, so the preview matches what will actually be saved.
  • Server-sideObjectFactory::createObject() honours the same flag during slugification, ensuring API submissions get the same treatment as admin saves.

The pattern is enforced at JSON Schema validation time (rejects raw input that wouldn’t be a valid snake_case id even after slugification — e.g. identifiers starting with a digit).

  • now - Current timestamp in milliseconds (e.g., 1692123456789)
  • timestamp - Current date/time in ISO format without colons/dashes (e.g., 20230815T143056)
  • uuid - Real UUID v4 format (e.g., 550e8400-e29b-41d4-a716-446655440000)
  • uid - Short random alphanumeric string, 7 characters (e.g., a4k7m2x)
  • uid-N - Random alphanumeric string of N characters (e.g., uid-12 → a 12-character id)
  • oid - Object ID counter (increments with each new object in collection)
  • oid-00000 - Zero-padded Object ID (e.g., oid-00001, oid-12345)
  • currentyear - Full 4-digit year (e.g., 2025)
  • currentyear2 - 2-digit year (e.g., 25)
  • currentmonth - Zero-padded month 01-12 (e.g., 01, 12)
  • currentday - Zero-padded day 01-31 (e.g., 01, 31)

Using timestamp for date-based IDs:

{
"autogen" : "${title}-${timestamp}"
}

Generates: my-post-20230815T143056

Using now for unique numeric IDs:

{
"autogen" : "item-${now}"
}

Generates: item-1692123456789

Using uuid for unique IDs:

{
"autogen" : "${title}-${uuid}"
}

Generates: my-post-550e8400-e29b-41d4-a716-446655440000

Using uid for short random IDs:

{
"autogen" : "${title}-${uid}"
}

Generates: my-post-a4k7m2x

Custom-length uid: append -N to set the character count (the bare ${uid} stays 7):

{
"autogen" : "${title}-${uid-12}"
}

Generates: my-post-a4k7m2xq8r3z

The oid placeholder provides automatic sequential numbering based on the collection’s object count:

{
"autogen" : "item-${oid}"
}

Generates: item-1, item-2, item-3, etc.

Zero-padded OID:

{
"autogen" : "product-${oid-00000}"
}

Generates: product-00001, product-00002, product-00003, etc.

Different padding lengths:

{
"autogen" : "${oid-000}"
}

Generates: 001, 002, 003, etc.

Combined with other placeholders:

{
"autogen" : "${title}-${oid-00}"
}

Generates: my-title-01, another-title-02, etc.

The OID counter automatically increments each time a new object is created in the collection, ensuring unique sequential IDs.

Note: ${oid} is only supported for collection object IDs. It is not available for deck item IDs. Use ${uuid} or ${uid} for auto-generated deck item IDs instead.

The date variables are useful for creating time-based IDs that sort chronologically:

Year-based membership IDs:

{
"autogen" : "${currentyear}-${oid-000000}"
}

Generates: 2025-000001, 2025-000002, etc.

Short date format:

{
"autogen" : "${currentyear2}${currentmonth}${currentday}-${oid-000}"
}

Generates: 251107-001, 251107-002, etc. (YY-MM-DD-ID format)

Invoice-style IDs:

{
"autogen" : "INV-${currentyear}${currentmonth}-${oid-0000}"
}

Generates: INV-202511-0001, INV-202511-0002, etc.

Membership cards:

{
"autogen" : "26-${currentyear2}-${oid-000000}"
}

Generates: 26-25-000001, 26-25-000002, etc.