ObjectStackObjectStack

Relationships & Lookups

Model relationships between objects — lookups, filtered lookups, self-referencing hierarchies, and related lists

Relationships & Lookups

Lookup (Many-to-One)

Creates a reference to another object:

fields: {
  account: Field.lookup('account', {
    label: 'Account',
    required: true,
  }),
}

Naming Convention: Use the object name directly (e.g., account, not account_id)

Filtered Lookups

Reference records that meet criteria, using lookupFilters for static conditions and dependsOn to scope candidates by another field on the same record:

contact: Field.lookup('contact', {
  label: 'Contact',
  dependsOn: ['account'],
  lookupFilters: [
    { field: 'is_active', operator: 'eq', value: true },
  ],
})

The legacy referenceFilters: string[] property (e.g. ['is_active = true']) is accepted by the schema but is not read by the record-picker UI — it filters nothing. Use the structured lookupFilters ({ field, operator, value }) and dependsOn shown above instead.

Self-Referencing Lookups

Create hierarchies:

parent_account: Field.lookup('account', {
  label: 'Parent Account',
  description: 'Parent company in hierarchy',
})

Child records automatically appear in related lists when a lookup points to the parent.

Example:

  • Account has many Contacts (Contact.account → Account)
  • Account detail page shows "Contacts" related list

Other relationship types

  • Master-detail (Field.masterDetail) — parent-child ownership with cascade delete and optional inline line-item editing on the parent form; see master_detail.
  • Tree (type: 'tree') — self-referential hierarchies (categories, org charts); see tree.
  • User (Field.user) — a person picker, i.e. a lookup specialized to the built-in sys_user object; see user.
  • Roll-ups over children — aggregate child records onto the parent with a summary field.
  • Querying across relationships — load related records with expand; see the query cheat sheet.

See also

On this page