ValidationRule
Concept: Objects, Records, and Fields →
A single entry in an object’s rules: block: a named boolean condition
that every record of the object must satisfy.
Carries a human-readable label, a formula expression evaluated as a
boolean predicate, and optional fields controlling the violation
message and which field an error is attributed to.
Properties
Section titled “Properties”| Property | Type | Required/Default | Constraints | Meaning |
|---|---|---|---|---|
label |
string | Required | Human-readable name for the rule, shown in error displays. | |
expression |
string | Required | The rule’s boolean formula expression, e.g. "score >= 0". |
|
message |
string | Optional | The message shown to the caller when a record violates this rule, e.g. "Score cannot be negative.". |
|
field |
string | Optional | min length 1; max length 63; pattern ^[a-z][a-zA-Z0-9]*$ |
Pins which field a violation of this rule is attributed to in the API error payload. |
Human-readable name for the rule, shown in error displays.
Distinct from the rule’s key in the rules: map — the label may
contain spaces and punctuation. Purely informational; not used to
identify the rule internally.
expression
Section titled “expression”The rule’s boolean formula expression, e.g. "score >= 0". See
the formula language reference for supported syntax.
Must be non-empty and must evaluate to a boolean. An empty expression, one that fails to compile, or one that evaluates to a non-boolean type each produce a compile-time diagnostic.
message
Section titled “message”The message shown to the caller when a record violates this rule,
e.g. "Score cannot be negative.". Absent by default.
When absent, a generic message derived from label is used
instead. When set, this string is returned verbatim in the API
error payload.
Pins which field a violation of this rule is attributed to in the API error payload. Absent by default.
When absent, attribution is derived automatically: an expression
that references exactly one field on this object attributes to
that field; anything else (multiple fields, a cross-object
reference, or a constant expression) attributes to the object as a
whole (__object). When set, the field must exist on the object
and appear in the expression — an invalid pin produces a
compile-time diagnostic and falls back to whole-object
attribution.
Example
Section titled “Example”{ "expression": "example", "label": "example"}