New to HubSpot and was looking to associate Contacts to ‘Custom_Object_x’ in our instance. Would I use the instructions here (Accounts Dashboard | HubSpot) to ‘Associate Custom Objects’? How would I define cardinality? (Do I need to define it?) It would be a one to many in this case.
Is there an example call you used? I have just started working with HubSpots APIs and would greatly appreciate any guidance.
Hello @AMorales7 , associations for custom objects are created automatically for some standard objects as per the documentation in this link. This means that the moment you create a custom object there are association definitions automatically created between the custom object and email, meeting_event, note, task, call, and conversation_session.
So the first thing to do is check the existing associations and their ids with POST https://api.hubapi.com/crm/v3/schemas/{objectType}/associations
As for the cardinality so far I think it’s defaulted by hubspot you can define it with the associations endpoint but overwriting it won’t work as expected, I have tried changing the association between my custom object and contacts to be ONE TO ONE / ONE_TO_MANY (one contact per custom object/many custom objects per contact) like below, it kind of worked but in the hubspot panel interface I could still choose multiple objects (contacts) but only the last one selected would stay (works but buggy).
So with a POST to https://api.hubapi.com/crm/v3/schemas/{CUSTOM_OBJECT_ID}/associations
@dennisedson see I’m into API’s too!!! Please tag other people who you think might be of help, I haven’t made any friends here yet (except of you ofcourse)
Incredibly helpful miljkovicmisa!! Many thanks for all the great detail. I dug into the docs you sent over the weekend. Quick question. If I wanted to check associations and get their ID’s as you mentioned wouldnt I use a GET call vs a POST?
@miljkovicmisa Purhaps you have an answer to my problem with Custom Objects as well.
I need to include custom object (CO) tokens in automated mails with standard objects:
1. Contact properties
2. Associated CO properties
3. Deal properties.
I’ve made the custom object (called Recipients) through API, and the object have a one-to-many relation with Deal object. In other words the Recipent can have several Deals, but the Deal can only have one Recipient.
I want to be able to include a contacts name, as well as the Recipient name, and the Deal name, but the Deal-centeret flow does not seem to pull the associated object property. The contact name is no problem.