ContactAssociations
Retrieve the IDs of all the objects associated to specific Deals objects in HubSpot. This table supports both OAuth and PrivateAppToken authentication.
View Specific Information
This is a sample associations table exposed when the ExpandAssociations connection property is set to False (default).
SELECT
A query to this table returns the Ids of all the records and their corresponding object type associated with a specific Contact record.
SELECT * FROM ContactAssociations
INSERT
To add a new association between a Contacts record and a Deals record, you need to specify the Id of the records to be associated as well as the deal object type.
INSERT INTO ContactAssociations (Id, AssociationId, Type) VALUES ('3432', '34654', 'Deal')
To add a new custom association between a Contact record and a Deals record, you need to also specify the TypeId and Category of the custom association.
INSERT INTO ContactAssociations (Id, AssociationId, Type, TypeId, Category) VALUES ('3432', '34654', 'Deal', '1', 'USER_DEFINED')
DELETE
To delete an existing association between a Contacts record and a Deals record, you need to specify the Ids of the two associated records and the associated deal object Type. Note that, for custom objects, you will need to specify the FullyQualifiedName as the Type.
DELETE [ContactAssociations] WHERE Id = '3432' AND AssociationId = '34654' AND Type = 'Deal'
DELETE
To delete an existing custom association between a Contacts record and a Deals record, you need to also specify the TypeId and Category of the custom association.
DELETE [ContactAssociations] WHERE Id = '3432' AND AssociationId = '34654' AND Type = 'Deal' AND TypeId='1' AND Category='USER_DEFINED'
Columns
Name | Type | ReadOnly | References | Filterable | Description |
Id [KEY] | Long | False |
Contacts.Id | False |
Contacts ID. |
AssociationId [KEY] | Long | False | False |
ID of the object that this Contact object is associated with. | |
Type [KEY] | String | False | False |
Type of the associated object_ which can be a contact_ deal etc. | |
TypeId [KEY] | String | False |
AssociationsLabels.TypeId | False |
The numeric ID for the association type. This column is empty for more general associations queries. |
Category [KEY] | String | False |
AssociationsLabels.Category | False |
The category of the association type for the specified object pair. This column is empty for more generic associations queries. |
TypeLabel | String | True |
AssociationsLabels.Label | False |
The label assigned to the association type between objects. |