CMS Development

Manobyte
Mitwirkender/Mitwirkende | Diamond Partner
Mitwirkender/Mitwirkende | Diamond Partner

Display associated custom object records

lösung

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 Upvotes
1 Akzeptierte Lösung
Brownstephen101
Lösung
Stratege/Strategin | Elite Partner
Stratege/Strategin | Elite Partner

Display associated custom object records

lösung

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

Lösung in ursprünglichem Beitrag anzeigen

1 Antwort
Brownstephen101
Lösung
Stratege/Strategin | Elite Partner
Stratege/Strategin | Elite Partner

Display associated custom object records

lösung

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