InvoiceAssociations
Retrieves the IDs of all the objects associated to specific Invoices objects in HubSpot.
Table-Specific Information
SELECT
The InvoiceAssociations table always includes the same set of columns, but some return NULL unless you filter by Id and Type, which allows the add-in to retrieve full association details. To return full details for Invoice associations, filter by both the Invoice Id and the association Type.
The Type identifies the associated object (such as a Deal, Company, Contact, or Ticket).
-- Retrieve all fields for associations between a specific Invoice and its related Deals
SELECT *
FROM InvoiceAssociations
WHERE Id = '436648510605' -- Invoice Id
AND Type = 'Deal'; -- Associated object type
Note: Fetching all fields can cause a reduction in performance, as it requires the add-in to make requests for each Invoice.
Filtering by multiple Invoice Id values with IN, combined with the association Type, retrieves associations for up to 1,000 Invoices in a single batched request instead of one request per Invoice. The add-in splits IN lists larger than 1,000 values into additional batched requests automatically.
-- Retrieve associations for multiple Invoices in a single batched request
SELECT *
FROM InvoiceAssociations
WHERE Id IN ('436648510605', '436648510606', '436648510607')
AND Type = 'Deal';
DELETE
To remove an Invoice association, include both the Invoice Id and the association Type:-- Delete an Invoice-Deal association
DELETE FROM InvoiceAssociations
WHERE Id = '436648510605' -- Invoice Id
AND Type = 'Deal'; -- Associated object type
Columns
| Name | Type | ReadOnly | References | Filterable | Description |
| Id [KEY] | Long | False |
Invoices.Id | False |
Invoices ID |
| AssociationId [KEY] | Long | False | False |
ID of the object that this Invoices object is associated with. | |
| Type [KEY] | String | False | False |
Type of the associated object, for example, a contact or deal. | |
| 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. |