Agreements
Gordon CRM includes a built-in agreement system for collecting digital signatures on waivers, intakes, and other compliance documents. The system uses tokenized clickwrap signing — each agreement is dispatched as a unique URL that the contact can open, review, and sign without logging in.
Data Model
The agreements system uses three tables:
agreement_templates
Stores the current/live version of each template.
| Field | Type | Description |
|---|---|---|
id | uuid | Primary key |
workspace_id | uuid | Tenant isolation |
title | text | Template name (e.g. "Standard Liability Waiver") |
body_html | text | Rich-text body content (HTML) |
version | integer | Current version number, starting at 1 |
is_active | boolean | Whether the template is active (visible for sending) or archived |
created_by | uuid | FK to user_profiles.id |
created_at | timestamptz | When the template was created |
updated_at | timestamptz | When the template was last modified |
agreement_template_versions
Append-only audit log of previous template body content. A new row is inserted each time the template body is edited.
| Field | Type | Description |
|---|---|---|
id | uuid | Primary key |
template_id | uuid | FK to agreement_templates.id (CASCADE delete) |
version | integer | The version number this row represents |
body_html | text | The body content at this version |
updated_by | uuid | FK to user_profiles.id — who made the change |
created_at | timestamptz | When this version was archived |
contact_agreements
Dispatched agreement instances — one row per contact per agreement sent.
| Field | Type | Description |
|---|---|---|
id | uuid | Primary key. Also serves as the signing token used in the public URL. |
workspace_id | uuid | Tenant isolation |
contact_id | uuid | FK to contacts.id |
template_id | uuid | FK to agreement_templates.id |
status | text | 'pending' or 'signed' (CHECK constraint) |
template_version | integer | The template version at time of signing (populated on sign) |
snapshot_body | text | The full HTML body captured at time of signing (immutable record) |
signed_by_name | text | The name the signer typed to sign |
signed_at | timestamptz | When the agreement was signed |
ip_address | text | IP address of the signer |
sent_by | uuid | FK to user_profiles.id — who dispatched the agreement (NULL for automated) |
created_at | timestamptz | When the agreement was sent |
Template Management
Agreement templates are managed at Settings → Agreement Templates (/settings/agreements).
Creating Templates
Click "New Template" to open a dialog with:
- Title — A descriptive name (e.g. "Standard Liability Waiver", "Client Intake Form")
- Body — Rich-text editor (tiptap) supporting bold, italic, bullet lists, and other formatting
Editing Templates
Click the pencil icon on any template to open the edit dialog. If the body content changes, the system automatically:
- Archives the current body to
agreement_template_versions - Increments the
versionnumber on the template
Title-only changes do not create a new version.
Version History
Templates with more than one version display a clock icon. Clicking it opens the version history dialog showing all previous versions with timestamps and a "View" button to inspect each version's body content in read-only mode.
Archive / Restore
- Archive — Marks the template as inactive (
is_active = false). Archived templates do not appear in the "Send Agreement" template picker. Existing pending agreements for archived templates remain valid and can still be signed. - Restore — Returns the template to active status.
Deleting Templates
Templates can only be deleted if they have no associated agreements (pending or signed). If agreements exist, the system returns an error: "This template has agreements associated with it. Please archive it instead."
RBAC
| Operation | Required Role |
|---|---|
| View templates | All members |
| Create / Edit / Archive / Delete templates | Owner or Admin |
| Send agreements to contacts | Owner or Admin |
| View agreement status on contacts | All members |
Related Documentation
- Dispatch & Signing — Sending agreements, dedup logic, public signing page, and snapshot integrity.
- Automations → Actions — The
send_agreementautomation action type. - Contacts — Agreements section on the Contact Detail page.