<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Creating An Association In Custom Code Workflow in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-An-Association-In-Custom-Code-Workflow/m-p/701287#M57501</link>
    <description>&lt;P&gt;Hi all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can some kind person point out what I'm doing wrong with the code below on my custom workflow? Everything else in my code works, but once I try an update, I'm hit with all sorts of erros no matter how much I tweak.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hubspotClient.crm.objects.associationsApi.create({&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;"fromObjectId": contact_id,&lt;BR /&gt;"toObjectId": found_company_id,&lt;BR /&gt;"category": "HUBSPOT_DEFINED",&lt;BR /&gt;"definitionId": 1,&lt;BR /&gt;"associationType": "contact_to_company"&lt;BR /&gt;}&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2022 12:43:24 GMT</pubDate>
    <dc:creator>James_Swallow</dc:creator>
    <dc:date>2022-10-03T12:43:24Z</dc:date>
    <item>
      <title>Creating An Association In Custom Code Workflow</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-An-Association-In-Custom-Code-Workflow/m-p/701287#M57501</link>
      <description>&lt;P&gt;Hi all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can some kind person point out what I'm doing wrong with the code below on my custom workflow? Everything else in my code works, but once I try an update, I'm hit with all sorts of erros no matter how much I tweak.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hubspotClient.crm.objects.associationsApi.create({&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;"fromObjectId": contact_id,&lt;BR /&gt;"toObjectId": found_company_id,&lt;BR /&gt;"category": "HUBSPOT_DEFINED",&lt;BR /&gt;"definitionId": 1,&lt;BR /&gt;"associationType": "contact_to_company"&lt;BR /&gt;}&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 12:43:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-An-Association-In-Custom-Code-Workflow/m-p/701287#M57501</guid>
      <dc:creator>James_Swallow</dc:creator>
      <dc:date>2022-10-03T12:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating An Association In Custom Code Workflow</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-An-Association-In-Custom-Code-Workflow/m-p/701311#M57502</link>
      <description>&lt;P&gt;Pretty sure you want this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;hubspotClient.crm.objects.associationsApi.create(contact_id,found_company_id,"HUBSPOT_DEFINED",1,"contact_to_company")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The function expects individual arguments, not an object. See &lt;A href="https://github.com/HubSpot/hubspot-api-nodejs#example-create-contact-company-and-associate-created-objects" target="_blank" rel="noopener"&gt;example&lt;/A&gt; documentation.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 13:16:39 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-An-Association-In-Custom-Code-Workflow/m-p/701311#M57502</guid>
      <dc:creator>LeeBartelme</dc:creator>
      <dc:date>2022-10-03T13:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating An Association In Custom Code Workflow</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-An-Association-In-Custom-Code-Workflow/m-p/701810#M57531</link>
      <description>&lt;P&gt;Hi Lee.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks loads for the help. Between your feedback and a colleague I got there. It’s:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;hubspotClient.crm.objects.associationsApi.create("CONTACT",contact_id,"COMPANY",found_company_id,"contact_to_company",1)
  
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main reason I was having issues was due to the fact that the you must explicitly state what the object type is before providing its ID number. I’d been trying this and it was still failing until I realised it’s case sensitive and must be in capitals, so ‘CONTACT’ and ‘COMPANY’ work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for pointing me in the right direction Lee&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 11:42:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-An-Association-In-Custom-Code-Workflow/m-p/701810#M57531</guid>
      <dc:creator>James_Swallow</dc:creator>
      <dc:date>2022-10-04T11:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating An Association In Custom Code Workflow</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-An-Association-In-Custom-Code-Workflow/m-p/765709#M62027</link>
      <description>&lt;P&gt;I know this thread may be old, but I was able to make it work by using only this syntax:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;hubspotClient.crm.objects.associationsApi.create("contacts",contactId,"companies", companyId, 'contact_to_company' )&lt;/LI-CODE&gt;&lt;P&gt;I thought for both companies and contacts the default object type is "contact" and "company" but it depends on how exactly your objects are named. In my case my objecst are "companies" and "contacts".&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Hope that helps!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 08:44:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-An-Association-In-Custom-Code-Workflow/m-p/765709#M62027</guid>
      <dc:creator>AStoyanov</dc:creator>
      <dc:date>2023-03-08T08:44:01Z</dc:date>
    </item>
  </channel>
</rss>

