CrmAssociations
Query the available CRM Associations in HubSpot.
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 |
The IDs of objects associated with the given object, based on the specified association type. | |
FromObjectId [KEY] | Long | False |
The ID of the object being associated. | |
ToObjectId [KEY] | Long | False |
The ID of the object the from object is being associated with. | |
Category [KEY] | String | False |
The category of the association. Currently this must be 'HUBSPOT_DEFINED'. | |
DefinitionId [KEY] | Long | False |
The ID of the association definition. |