Create a custom field definition
Defines a new custom field on one kind of record. The options object decides the field's type and its validation rules, and the type cannot be inferred: you must send options.type.
Authorization
AuthorizationstringrequiredBody
application/json
entityTypeenum<string>requiredWhat kind of record the field hangs off.
namestringrequiredLabel shown next to the input, 1 to 100 characters.
descriptionstringHelp text, up to 500 characters.
publicbooleanrequiredWhether tenants, owners and vendors see the value in their own portals.
filterablebooleanrequiredWhether the field can be filtered on.
listablebooleanrequiredWhether the field can be shown as a list column.
orderintegerrequiredWhere the field sits among the others. Lower sorts first.
optionsobjectrequiredThe field's type and validation rules. type is the discriminator and decides which other properties are read.
Response
200 · The definition that was created.
idstringThe custom field definition. A Snowflake id sent as a decimal string.
entityTypeenum<string>What kind of record this field can be set on.
namestringLabel shown next to the input.
descriptionstringHelp text. Absent when none was set.
publicbooleanWhether tenants, owners and vendors can see the value in their own portals.
filterablebooleanWhether the field can be filtered on in lists and reports.
listablebooleanWhether the field can be shown as a column in lists.
orderintegerWhere the field sits among the others. Lower sorts first.
optionsobjectThe field's type and its validation rules.
activebooleanWhether the field is still in use. A deactivated field keeps its stored values.
createdstring · date-timeWhen the field was created, in the company's timezone.
updatedstring · date-timeWhen it was last changed, in the company's timezone.
400 · `options.type` was missing or not one of the five known types, or a rule did not fit the type.
401 · The access token is missing, expired, or not valid for this company.
This resource creates and edits the definitions: what the field is called, what kind of record it hangs off, and what a valid value looks like. The values themselves are set and read on the record they belong to, through that record's own endpoints.
Because the definitions are written by the company, a value has no single fixed type. Which JSON property carries it depends entirely on options.type on the definition.
options.type | Which value slot the field uses | Rules you can set |
|---|---|---|
string | stringValue, or stringArray when multiple is true | minLength, maxLength, values, rejectUnknown, multiline, multiple, default |
number | numberValue | min, max, step, default |
boolean | booleanValue | default |
datetime | dateTimeValue | min, max, default, dateOnly |
reference | referenceValue, or referenceArray when multiple is true | referenceEntityType, multiple |
So to read a value you first look up its definition by customFieldId, read options.type, and then read the matching property off the value. There is no generic value property.
{
"entityType": "lease",
"name": "Parking space",
"public": true,
"filterable": true,
"listable": true,
"order": 10,
"options": {
"type": "string",
"required": false,
"values": ["None", "A1", "A2", "B1"],
"rejectUnknown": true
}
}{
"entityType": "unit",
"name": "Storage lockers",
"public": false,
"filterable": true,
"listable": false,
"order": 20,
"options": {
"type": "number",
"required": true,
"min": 0,
"max": 4,
"step": 1,
"default": 0
}
}{
"entityType": "property",
"name": "Roof last inspected",
"public": false,
"filterable": true,
"listable": true,
"order": 30,
"options": {
"type": "datetime",
"required": false,
"dateOnly": true
}
}{
"entityType": "lease",
"name": "Preferred contractor",
"public": false,
"filterable": false,
"listable": false,
"order": 40,
"options": {
"type": "reference",
"required": false,
"referenceEntityType": "vendor",
"multiple": false
}
}