Overview
A view is a saved configuration for how records of an object are displayed: which fields appear, their order, whether they’re visible, and any filters or groups applied. UsedefineView() to ship pre-configured views with your app.
Every object automatically gets its main list view (the “All …” table an OBJECT navigation item opens) provisioned by the server — including the objects your app creates, with one column per field your app declares. Views you define with defineView() are always additional views on top of that default one.
src/views/example-view.ts
Key points
objectUniversalIdentifierspecifies which object this view applies to. It can be a custom object you defined or a standard Twenty object.- The object’s main list view is server-owned:
keyis deprecated and ignored, so a manifest view can never claim it. Ship aVIEWnavigation item if you want your view one click away in the sidebar. fieldscontrols which columns appear and in what order. Each field references afieldMetadataUniversalIdentifier. To reference an auto-created system field such ascreatedAt, see Targeting System Metadata.- Set
isCanonical: falseon a field to add an extra column for a field the view already shows. A view has at most one canonical column per field but any number of non-canonical ones. They are not allowed on the object’s label identifier field or in widget views, andisCanonicalis set when the column is created: changing it later has no effect. - A non-canonical column on a many-to-one relation field, or on a one-to-many relation field with a
relationScope, can setrelationTargetFieldMetadataUniversalIdentifierto show a field of the related records instead of the records themselves. The target must be a non-relation field of the related object. - A sort on a many-to-one relation field can set
relationTargetFieldMetadataUniversalIdentifierto order records by a field of the related record, such as people by their company’s employees. The target must be a non-relation field of the related object. - A non-canonical column on a one-to-many relation field can set
relationScopeto filter, sort and limit the related records it shows. See Relation scope. - A non-canonical column on a one-to-many relation field with a
relationScopecan setaggregateOperationinside itsrelationScopeto show, per row, a summary of the related records the scope keeps instead of the records, such as the count of open tasks or the sum of the amounts of open opportunities.COUNTtakes no target, whileSUM,AVG,MINandMAXneedrelationTargetFieldMetadataUniversalIdentifierset to a field of the related object that supports the operation (a number or currency field, or a date forMINandMAX). Its scope keeps filters only: sorts and a limit are rejected. These columns are display-only. This is separate from the view field’s ownaggregateOperation, which sets the total shown in the column’s footer. - Set
labelon a field to replace its default column header. It is trimmed, at most 63 characters, and an empty label shows the default header. A workspace can rename a column your app owns without changing your manifest. - You can also declare
filters,filterGroups,sorts,groups, andfieldGroupsfor advanced configurations. positioncontrols ordering when multiple views exist for the same object.
Optional properties
All enums above are exported from
twenty-sdk/define.
Filters
A view can ship with pre-applied filters. Each filter has three coordinates: the field being filtered, the operand (how to compare), and the value (what to compare against). All three must line up — using an operand that doesn’t apply to a field type will be rejected at sync time.twenty app pull writes all three back exactly as the workspace stored them.
Supported operands per field type
Field types with similar names can use entirely different operands —SELECTandMULTI_SELECTbeing a common case.
Value shape per operand
Thevalue field is always a JSON-serializable value, but its expected shape depends on the operand:
Relation scope
ArelationScope on a non-canonical one-to-many column, such as “Open tasks” on companies, narrows the related records the column shows. Filters and sorts follow the view filter and sort shapes above, with field references as universal identifiers:
Deleting or deactivating a field a scope uses removes the column, rather than dropping the condition and showing more records.
How views show up in the UI
A view by itself isn’t reachable from the sidebar. To make it appear there, pair it with a navigation menu item of typeVIEW that points at the view’s universalIdentifier. That’s the canonical pattern: every custom object gets a default index view auto-generated at creation, so you only need to ship the sidebar entry that opens it.