Skip to main content

Fields

The fields of a class are its typed properties. Each field has a name, a data type and optional constraints. A class has its own fields plus every field it inherits.

Definition​

{
"name": "lastName",
"dataType": "TEXT",
"required": true
}
PropertyTypeDefaultDescription
namestring—Field name, lowerCamelCase. Must be unique within the class, inherited fields included.
dataTypeValueDataTypeTEXTThe type of value this field stores.
requiredbooleanfalseIf true, the field must have a value.
multiplebooleanfalseIf true, the field stores a list of values.
enabledbooleantrueIf false, the field exists in the model but is hidden from the UI.
hiddenbooleanfalseIf true, the field is stored but never shown in the UI.
uniquebooleanfalseIf true, no two objects of this class can have the same value for this field.
historyEnabledbooleanfalseIf true, the field keeps its earlier values, each with the date until which it was valid. Cannot be combined with multiple.
listQualifiedName—For LIST data type: reference to a StandardList definition. See Lists.
descriptionstring—What the field means, in English. Returned by the class definition. See Descriptions.
defaultValueany—Fallback default for auto-generated forms. Applied server-side on create when no value is provided. Values that cannot be parsed for the field's data type are silently ignored.
indexedbooleanper data typeWhether the field is included in the general search. By default every data type is, except LONGTEXT, JSON, ARRAY, FILE, IMAGE and SECRET. A SECRET field is never indexed. See Search.

Descriptions​

A class, field, relation, graph (and each of its edge kinds), list and list item can carry an optional description: a sentence or two of English text for agents and generated documentation. The class definition endpoint returns it, so an agent that discovers a model learns what a field means instead of guessing from its name.

{
"name": "financialInterest",
"dataType": "PERCENTAGE",
"description": "Share of the company's capital held, stored as a fraction: 100% is 1, 60% is 0.6. Filled by the user; leave empty for a non-capital interest such as a directorship."
}

A description is not a translation. Translations are labels for the UI in several languages; a description is always English and explains the value rather than naming it. A description does not make a hidden field visible.

Writing a description​

Say what an agent cannot see from the name and data type:

  • What the value means, and its unit or format: a fraction rather than a percentage, a currency, a time zone.
  • Who fills it: a formula, a gateway or script, or the user, and when.
  • When not to use it: a field that only applies in one situation, or is only reliable in a certain state.

Do not repeat the name. "description": "The first name" on firstName adds nothing; leave it out.

Instead ofWrite
"Group first registered""Date the company was first registered, used only for billing per group company. The date it joined the group is groupEntryDate."
"Markdown content""Document text as Markdown, filled by the extraction gateway. Only reliable when markdownStatus is READY."

How descriptions resolve​

  • A field takes the most specific declaration that has a description: a subclass that declares the field again overrides the one it inherits.
  • An EXTENSION replaces the description of the class it extends, and of a field it patches. Class descriptions are not merged.
  • A relation's description is shown on both sides of the relation. An extension cannot re-describe an existing relation, because extensions add relations rather than patch them.
Deploy order

Definitions are checked strictly, so a platform version that does not know description refuses a model that uses it. Deploy content-api with description support before a model starts using it. Adding a description is not a format change: it needs no upgrade.

Naming rules​

A field name is lowerCamelCase: a lowercase letter followed by letters and digits (lastName, vatNumber2). It never contains _ — names starting with _ belong to the platform's own properties (_class, _creationDate, _modificationDate), and _ also separates a field name from the suffix of a query parameter (amount_from). A model with a field name that breaks this rule is refused.

Field names must be unique within the effective class, including all inherited fields. name is declared once, on commons.item, and inherited by every class: do not declare it again.

The name field​

commons.item defines a required field called name. This is the display name of every object. All classes inherit this field. It is typically overridden by a formula that computes it from other fields.

For example, commons.person computes name as:

{
"field": "name",
"template": "{{firstName}} {{lastName}}"
}

Display name: nameField​

By default an object's display name is its name field. A class can point at another field with nameField:

{
"version": 1,
"class": "my-project.vessel",
"kind": "BASIC",
"inherits": "commons.item",
"nameField": "registrationCode",
"fields": [
{ "name": "registrationCode", "required": true }
]
}

Data types​

See Data Types for the full reference.

Examples​

A minimal text field:

{ "name": "jobTitle" }

A required text field:

{ "name": "lastName", "required": true }

An optional date field, disabled by default:

{ "name": "birthdate", "dataType": "DATE", "enabled": false }

An email field:

{ "name": "emailAddress", "dataType": "EMAIL" }

A field that stores a list of values:

{ "name": "tags", "multiple": true }

A field backed by a predefined list:

{ "name": "status", "dataType": "LIST", "list": "my-project.contractStatus" }

A field with a schema-level default (used in auto-generated forms):

{ "name": "hoursPerWeek", "dataType": "INTEGER", "defaultValue": 40 }

Default values​

defaultValue on a field is a schema-level fallback applied by the platform when an auto-generated form creates a new object and the field has no value. It is only relevant when no explicit layout exists — forms built with an OBJECT_FORM_DASHBOARD layout should set defaults there instead using FIELD.defaultValue, which takes priority.