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¶
- Open the source module → Relationships tab → Add.
- Fill in: type, target module, name, label, foreign key.
- Save.
ZaazCRM creates the FK column (if belongsTo), generates the related tab, and allows accessing connected records in templates and reports.

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
belongsToContact. - Contact
hasManyCases. - Contact
belongsToCompany. - Company
hasManyContacts. - Lead
belongsToContact. - Quote
belongsToLead (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.