ContactAssociations
Retrieve the IDs of all the objects associated to specific Contacts objects in HubSpot. This table supports both OAuth and PrivateAppToken authentications.
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 will return will return the Id-s of all the records and their corresponding object type associated to a specific Contact record.
SELECT * FROM ContactAssociations
INSERT
To add a new association between a Contacts record and a Deals one, you need to specify the Id-s of the two records to be associated and the deal object type.
INSERT INTO ContactAssociations (Id, AssociationId, Type) VALUES ('3432', '34654', 'Deal')
To add a new association between a Contacts record and a Custom Object one, you need to specify the Id-s of the two records to be associated and the Custom Object FullyQualifiedName as the Type. Note: You can find the Object FullyQualifiedName by querying the CustomObjects view.
INSERT INTO ContactAssociations (Id, AssociationId, Type) VALUES ('3432', '453545', 'p5692228_event')
DELETE
To delete an existing association between a Contacts record and a Deals one, you need to specify the Id-s of the two associated records and the associated deal object Type. Note for custom objects, you will need to specify the FullyQualifiedName as the Type.
DELETE [ContactAssociations] WHERE Id = '3432' AND AssociationId = '34654' AND Type = 'Deal'
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 Contacts 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 | False |
The numeric ID for the association type. This column is empty for more general associations queries. | |
TypeName [KEY] | String | True |
AssociationsTypes.Type | False |
The name of the association type for the specified object pair. This column is empty for more specific associations queries. |