CMS Development

Manobyte
Colaborador | Partner nivel Diamond
Colaborador | Partner nivel Diamond

Display associated custom object records

resolver

I created the custom object "Jobs", I then created an association for Jobs to contacts. I would like to pull all associated jobs for the individual contact, only I seem to be running into an issue.

 

I have reviewed the documentation here for CRM associations , and I can make it pull a list of contacts associated with a job using {{ crm_associations(jobID, "USER_DEFINED", 17) }} but when I try to switch it to list jobs, nothing is returned. Is the "association type id" different if you invert them?

0 Me gusta
1 Soluciones aceptada
Brownstephen101
Solución
Colaborador líder | Partner nivel Elite
Colaborador líder | Partner nivel Elite

Display associated custom object records

resolver

Yes, the ID is different when you invert them, when you created your object it should have returned it's associations and their different ids. In the json, there should be a "From" and "To" key for each pairing. You have to make sure the ID you are using from the proper direction.

Example:

{
"fromObjectTypeId": "2-3444025",
"toObjectTypeId": "2-555555",
"name": "cat_to_dog"
}



If you dont have the json, you can run a "Read" request on your object to get the json again. Or, In my experience, the id will normally be 1 off of your current use case (so likely 16 or 18), so you could try to just update it that way and see if that works, but this isn't always the case.

https://developers.hubspot.com/docs/api/crm/crm-custom-objects

Ver la solución en mensaje original publicado

1 Respuesta 1
Brownstephen101
Solución
Colaborador líder | Partner nivel Elite
Colaborador líder | Partner nivel Elite

Display associated custom object records

resolver

Yes, the ID is different when you invert them, when you created your object it should have returned it's associations and their different ids. In the json, there should be a "From" and "To" key for each pairing. You have to make sure the ID you are using from the proper direction.

Example:

{
"fromObjectTypeId": "2-3444025",
"toObjectTypeId": "2-555555",
"name": "cat_to_dog"
}



If you dont have the json, you can run a "Read" request on your object to get the json again. Or, In my experience, the id will normally be 1 off of your current use case (so likely 16 or 18), so you could try to just update it that way and see if that works, but this isn't always the case.

https://developers.hubspot.com/docs/api/crm/crm-custom-objects