Documents and Attachments
The document system separates the document definition from its attachment links. A single document can be attached to multiple entities without duplication, and each document maintains its own version history.
Document definitions
The central document index stores logical documents — files, URLs, or inline text.
Identity and classification:
| Attribute | Purpose |
|---|---|
| Document code | Business-readable identifier (unique per organisation + tenant) |
| Title | Display title |
| Category | Lookup-backed category (e.g. POLICY_WORDING, CONTRACT, INVOICE) |
Content types:
| Type | Meaning |
|---|---|
FILE | Binary file |
URL | External URL reference |
SHORT_TEXT | Inline short text content |
LONG_TEXT | Inline long text content |
WEB_PAGE | Web page reference |
Storage types:
| Type | Meaning |
|---|---|
Cloud | Cloud object storage |
INLINE | Content stored directly in the document record |
EXTERNAL_URL | External URL reference |
Source tracking — for documents fetched from external sources, the system records the original URL, ETag, last-modified timestamp, and a content hash for change detection and deduplication.
Security — each document has a visibility scope (NONE, ORGANIZATION, TENANT), a usage type (one-time/private or standard/shareable), and a publish flag controlling broader access.
Status lifecycle: DRAFT → ACTIVE → PROCESSING → PROCESSED → FAILED → ARCHIVED
Attachments
A generic linking mechanism connects documents to any entity in the system:
| Attribute | Purpose |
|---|---|
| Document | The document being attached |
| Entity type | The type of the target entity (e.g. Customers, Jobs) |
| Entity | The specific target entity |
| Attachment type | How the document relates to the entity |
This approach avoids needing separate attachment configuration for every entity type. Any entity type in the platform can have documents attached to it.
Versioning
Documents maintain a version history. Each version records a sequential version number, file size, content hash, and change description. The document always tracks which version is the current one.
Access control
Documents use relationship-based access control:
- The creating user is automatically recorded as the document owner
- Read access requires domain permission, ownership, or a viewer relationship
- Update access requires domain permission or an editor relationship
- Any authenticated user can create a document