CrmAssociations
Queries CRM object associations within HubSpot, essential for understanding relationships between CRM entities.
Table Specific Information
The CrmAssociations table is used to manage associations between tickets, products, line items, and their related contacts, companies, and deals.
SELECT
Get the IDs of objects associated with the given object (FromObjectId), based on the specified association type (DefinitionId).See the HubSpot API documentation for a list of DefinitionIds. FromObjectId and DefinitionId are required. For example, to get the ticket IDs for all tickets associated with a contact record with vid 25, the FromobjectId would be 25, and the definitionId would be 15:
SELECT * FROM CrmAssociations WHERE FromObjectId = '25' AND DefinitionId = '15'
INSERT
You would use insertion to associate a ticket with a contact, or to associate a line item object to a deal. When creating a new CRM Association FromObjectId, ToObjectId, Category (currently this must be 'HUBSPOT_DEFINED') and DefinitionId are required. For example:
INSERT INTO CrmAssociations (FromObjectId, ToObjectId, Category, DefinitionId) VALUES (496346, 176602, 'HUBSPOT_DEFINED', 15)
UPDATE
UPDATEs are not supported for this table.
DELETE
When deleting a CRM Association FromObjectId, ToObjectId, Category (currently this must be 'HUBSPOT_DEFINED') and DefinitionId are required. For example:
DELETE FROM CrmAssociations WHERE FromObjectId = 496346 AND ToObjectId = 176602 AND Category = 'HUBSPOT_DEFINED' AND DefinitionId = 15
Columns
| Name | Type | ReadOnly | References | Description |
| Results | String | True |
Comma-separated list of object IDs associated with the specified object, filtered by the given association type. | |
| FromObjectId [KEY] | Long | False |
Unique identifier of the source object being associated. | |
| ToObjectId [KEY] | Long | False |
Unique identifier of the target object being associated to the source object. | |
| Category [KEY] | String | False |
Specifies the association category. Currently, only 'HUBSPOT_DEFINED' is supported. | |
| DefinitionId [KEY] | Long | False |
Unique identifier of the association definition used to describe the relationship between objects. |