I have to find multiple Deal with Company relations (in general I need only the company name and ID).
I use /crm/v3/objects/deals/search endpoint and it's fine, but then I need to get somehow Companies for my Deals.
I see that you have "/crm/v3/objects/deals/{dealId}/associations/{toObjectType}" but I have to call it for each deal, what is crazy when I have hundreds of deals.
Read batch "/crm/v3/objects/deals/batch/read" has no any information about associations.
Any ideas on how I can query the Company name for a Deal for a reasonable time?
I totally hear your hassle. This very inconvenient to deal with (pun intended), especially if you don't know how much you will be receiving with your calls. You then end up creating for loops and all of those things, which feels very heavy and slow.
Luckily, HubSpot got into the GraphQL game and there is a beta right now you can sign up to. I recommend this left and right because HubSpot has a lot of power with its associations, but accessing them from outside can be tricky.
Hope this helps you get going. If you found this post helpful, consider helping others in the community to find answers faster by marking this as a solution. I'd really appreciate it.
I had the same problem and there's a little workaround that may help you do without the graph QL option:
Use the search endpoint on the companies object, and use your previous id list as a filter as follows
{
"filters" : [
{
"propertyName" : "associations.deal",
"operator": "IN",
"values": ["8260189334", "87847557"] <-- list of IDs goes there
}
],
"properties" : ["firstname", "email"]
}
This only works if you just need to get the list, but won't if you need to get which company is associated with it since the results are not in the order of the ids in the values list.
Maybe with a helper property automatically populated with a workflow you can link them back together using this method.
Best,
Ludwig
CTO @ Mi4 Hubspot Platinum Partner and Integration Expert
Passionate human, very curious about everything data and automation.
I had the same problem and there's a little workaround that may help you do without the graph QL option:
Use the search endpoint on the companies object, and use your previous id list as a filter as follows
{
"filters" : [
{
"propertyName" : "associations.deal",
"operator": "IN",
"values": ["8260189334", "87847557"] <-- list of IDs goes there
}
],
"properties" : ["firstname", "email"]
}
This only works if you just need to get the list, but won't if you need to get which company is associated with it since the results are not in the order of the ids in the values list.
Maybe with a helper property automatically populated with a workflow you can link them back together using this method.
Best,
Ludwig
CTO @ Mi4 Hubspot Platinum Partner and Integration Expert
Passionate human, very curious about everything data and automation.
Thanks for a workaround, but names without relations do not make sense in my case.
I also thought about simple text properties and automation when the company is assigned to the deal., it looks like the most efficient solution so far.
I totally hear your hassle. This very inconvenient to deal with (pun intended), especially if you don't know how much you will be receiving with your calls. You then end up creating for loops and all of those things, which feels very heavy and slow.
Luckily, HubSpot got into the GraphQL game and there is a beta right now you can sign up to. I recommend this left and right because HubSpot has a lot of power with its associations, but accessing them from outside can be tricky.
Hope this helps you get going. If you found this post helpful, consider helping others in the community to find answers faster by marking this as a solution. I'd really appreciate it.