Create Custom Object Association in Custom code in Workflow

SOLVE
Sylg
Participant

Hey Everyone,

 

I'm building a workflow that will 

 

  1. find the associated company of a workspace (custom object)
  2. look if this company has an associated open deal
  3. If so, associate the workspace to the deal

On paper, this is straight forward but I can't find the function of the nodeJs library to lookup association on a custom object and to create an association on a custom object

 

According to the CRM API v3 docs, it should be 

 

hubspotClient.crm.associationsApi.getAll(objectType, objectId, toObjectType, after, limit);

 to lookup an association but this return 

 

{"errorType":"TypeError","errorMessage":"Cannot read property 'getAll' of undefined","stack":["TypeError: Cannot read property 'getAll' of undefined","    at Object.exports.main

I tried doing the call via HTTP in Postman and the endpoint work.

 

Can someone tell me the function to lookup associated objects and the function to create an association with a custom object, please?

 

Thanks

0 Upvotes
1 Accepted solution

Accepted Solutions
kierana
Solution
Contributor

The documentation is actually incorrect for this - It's always worth using Intellisense in your IDE to get the right methods. Try

hubspotClient.crm.objects.associationsApi.getAll(.....)

View solution in original post

2 Replies 2
dennisedson
Community Manager

@kierana  maybe you have some ideas 😀

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
kierana
Solution
Contributor

The documentation is actually incorrect for this - It's always worth using Intellisense in your IDE to get the right methods. Try

hubspotClient.crm.objects.associationsApi.getAll(.....)

View solution in original post