Companies
Overview

Companies

Gordon CRM supports Business-to-Business (B2B) workflows through a Companies module that layers organization-level data on top of the existing contact-centric model. Companies are an optional, toggleable feature — workspaces that don't need B2B capabilities can leave the module disabled entirely.

Data Model

The Companies feature introduces two database tables:

Companies Table

Stores organization-level metadata:

ColumnTypeDescription
iduuidPrimary key
workspace_iduuidTenant isolation
nametextCompany name (required)
domaintextCompany website domain (e.g. acme.com)
phonetextMain phone number
address_line1textStreet address
address_line2textSuite, floor, etc.
citytextCity
statetextState or province
postal_codetextZIP / postal code
countrytextCountry
notestextFree-form notes about the company
created_byuuidUser who created the record
updated_byuuidLast user to edit the record
created_attimestamptzCreated timestamp
updated_attimestamptzLast updated timestamp

Company Contacts Junction Table

Links contacts to companies with a many-to-many relationship. A single contact can be linked to multiple companies (e.g. a consultant who serves several clients), and a company can have many linked contacts.

ColumnTypeDescription
company_iduuidFK → companies.id
contact_iduuidFK → contacts.id
job_titletextThe contact's role at this company (e.g. "VP of Sales")
work_emailtextBusiness email address (separate from personal email on the contact record)
work_phonetextBusiness phone number
is_primarybooleanMarks this contact as the primary point of contact for the company

Note: A unique constraint on (company_id, contact_id) prevents duplicate links. Attempting to link the same contact twice returns a friendly "already linked" error.

Bidirectional Navigation

The company↔contact linkage is accessible from both directions in the dashboard:

  • Company → Contact: The company detail page has a Contacts tab that lists all linked contacts with their job title, work email, and work phone. Clicking a contact name navigates to the contact's detail page.

  • Contact → Company: The contact detail page has a Companies tab (visible only when the companies module is enabled) that lists all companies the contact is associated with.

RBAC

Companies follow the Operational Data access model:

RoleCreateReadEditDelete
Owner
Admin
Member

Delete operations are restricted to admin and above using the requireRole helper, which preserves audit trails by preventing members from accidentally removing organization records.

Cross-Module Integration

When the Deals module is also enabled, the company detail page gains an additional Deals tab that lists all deals where this company is the primary entity. This tab is conditionally rendered based on the deals module toggle — if Deals is disabled, the tab does not appear.

Next Steps

  • Company Management — Create, edit, link contacts, and manage company records.
  • Module Toggles — How optional modules (Companies, Deals, Appointments) are enabled or disabled per workspace.