Activity links sub-object on models
Appointments, documents, sales can link to each other
The system uses the relation table (originally used only for person/contact relations).
This replaced the old single-value
DocumentLink property that
Sale used to have before SuperOffice 6.
The system uses the relation table to allow many-to-many links between all activities.
This appointment is saved with
appointment_id = 24
To find all the links from this appointment:
select * from relations where source_table=9 and source_record=24
These links are all defined by
reldef_id = 8 (appointment), 9 (document), and 10 (sale), which looks like this:
Select * from relationdefinition
A relationship definition can apply to more than one table.
In this case, the link can be to appointments, documents, or sales:
Select * from relationtarget where reldef_id in (8, 9, 10)
To summarize in diagram form: