APIs & Integrations

RAraujo0
Member

Is it possible to associate an object using a custom property?

SOLVE

Is is possible to associate an object to another through association api using a custom property instead of the hs_object_id?

 

/crm/v4​/objects​/{fromObjectType}​/{fromObjectId}​/associations​/default​/{toObjectType}​/{toObjectId}

 

This "fromObjectId" and "toObjectId" needs to be the hs_object_id or can be a custom property?

0 Upvotes
1 Accepted solution
SteveHTM
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Is it possible to associate an object using a custom property?

SOLVE

The API URL is contstructed as you suggest (in Python for example):

"https://api.hubapi.com/crm/v4/objects/" + ContactType + "/" + str(ContactId) + "/associations/" + CompanyType + "/" + str(CompanyId)

 

But if you have a custom object type, you substitute that type identifier and Object ID for one or both of these inserted value pairs. Clearly the ID in question is the HubSpot object ID for whatever type of object - however you have obtained that value previously. It could be hard coded or a value from another property - its just a digit string.

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature

View solution in original post

0 Upvotes
3 Replies 3
SteveHTM
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Is it possible to associate an object using a custom property?

SOLVE

@RAraujo0 - perhaps i'm misunderstanding your question, but using that API any hard coded value or property value can be used to pass the hubspot id value for the two objects you are trying to associate, Just make sure that the association ID is defined for the relationship between the objects.

 

Hope that helps.

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes
RAraujo0
Member

Is it possible to associate an object using a custom property?

SOLVE

My question is: to associate a contact to a company for example, can I use a custom property as the ID or it always need to be the main ID from contact?

/crm/v4​/objects​/contacts​/{mainID or custom property as ID?}​/associations​/default​/companies/{mainID or custom property as ID?}

0 Upvotes
SteveHTM
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Is it possible to associate an object using a custom property?

SOLVE

The API URL is contstructed as you suggest (in Python for example):

"https://api.hubapi.com/crm/v4/objects/" + ContactType + "/" + str(ContactId) + "/associations/" + CompanyType + "/" + str(CompanyId)

 

But if you have a custom object type, you substitute that type identifier and Object ID for one or both of these inserted value pairs. Clearly the ID in question is the HubSpot object ID for whatever type of object - however you have obtained that value previously. It could be hard coded or a value from another property - its just a digit string.

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes