Concepts
Fields and types
The field catalogue: system names, display names and the seven field types.
Every value an entity holds is a field from the global field catalogue. Perspectives choose fields from the catalogue; they don't define their own.
What a field has
| Property | Example | Notes |
|---|---|---|
| System name | creditLimit | The JSON key that's stored. Unique ignoring case, so email and Email can't both exist. Can't start with _. |
| Display name | Credit Limit | What forms and views show. |
| Type | Decimal | One of the seven types below. It can't change once the field is defined. |
| Description | Optional help text. |
Types
| Type | JSON value | In queries |
|---|---|---|
Text | string | Compared ignoring case. ~= (contains) works only on Text. |
Integer | number (64-bit integer) | |
Decimal | number | |
Boolean | true / false | Only = and !=. |
DateTime | ISO 8601 string | Compared as instants; a value without an offset is treated as UTC. |
Reference | GUID string | The id of another entity. Only = and !=. Relationships use Reference fields. |
Json | any JSON value | Not type-checked, and can't be indexed. |
More detail, including how each type is indexed and sorted, is in Field types.
Where a field is used
A field can be in any number of perspectives. GET /api/schema/fields/{name}/interfaces lists them: those are the
places a value will also appear. This matters for security too: a perspective's manager can't add a field that another
perspective they don't manage already uses, since that would show its values to their readers. See
Roles and permissions.
Defining fields
- On the maker site: Fields → New field….
- With occtl:
occtl schema field set creditLimit --type Decimal --display-name "Credit Limit". - With the API:
PUT /api/schema/fields/creditLimitwith{ "displayName": "Credit Limit", "type": "Decimal" }. - In a plugin's manifest, which adds its schema when the plugin is installed.