Skip to content

Module relationships

Why this matters

Relationships are the connections between modules: a case "belongs to" a contact; a contact "has many" cases; a company "has many" contacts and leads. These connections generate the related tabs and let you navigate between records.

Relationship types

  • belongsTo — points to another (FK).
  • hasMany — has several on the other side.
  • hasOne — has exactly one.
  • belongsToMany — many-to-many with a join table.
  • morphTo / morphMany — polymorphic (can relate to several types).

Create a relationship

  1. Open the source module → Relationships tab → Add.
  2. Fill in: type, target module, name, label, foreign key.
  3. Save.

ZaazCRM creates the FK column (if belongsTo), generates the related tab, and allows accessing connected records in templates and reports.

Screenshot: relationship editor

How relationships look in use

In a contact's detail, the Cases, Leads, Invoices tabs are each a relationship made visible. ZaazCRM uses the display_name field to show each record.

Modify or delete

  • Rename label — instant, no effect on data.
  • Change relationship type — only if no data exists.
  • Delete the relationship — the tab disappears but data remains.

Common patterns in ZaazCRM

  • Case belongsTo Contact.
  • Contact hasMany Cases.
  • Contact belongsTo Company.
  • Company hasMany Contacts.
  • Lead belongsTo Contact.
  • Quote belongsTo Lead (when applicable).

Watch out for

  • Polymorphic relationships are complex.
  • Foreign keys with data don't change.
  • Deleting the parent can affect children (cascade vs restrict).

Where to next

  • Workflows — automation based on relationships.
  • Visibilities — control what's shown on related tabs.