<?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 Form submission error when form contains company property in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Form-submission-error-when-form-contains-company-property/m-p/766283#M62076</link>
    <description>&lt;P&gt;I submitted form data to a HubSpot form using &lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/submit_form" target="_blank" rel="noopener"&gt;this&lt;/A&gt; endpoint.&lt;/P&gt;&lt;P&gt;However, error occurred when the form contains company property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My form fields are as follows:&lt;/P&gt;&lt;P&gt;・lastname&lt;/P&gt;&lt;P&gt;・firstname&lt;/P&gt;&lt;P&gt;・email&lt;/P&gt;&lt;P&gt;・phone&lt;/P&gt;&lt;P&gt;・name (Company property)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Only "name" which is company name, is company property and the rest are all contact property.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const options = {
  headers: {
    'Message-Type': 'application/json',
  },
};

const portalId = 'xxxxx';
const formGuid = 'xxxxx';
const url = `https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formGuid}`;

await axios.post(
  url,
  {
    portalId,
    formGuid,
    fields: [
      {
        name: 'lastname',
        value: 'test1',
      },
      {
        name: 'firstname',
        value: 'test2',
      },
      {
        name: 'email',
        value: 'test@example.com',
      },
      {
        name: 'phone',
        value: 0801234567,
      },
      {
        name: 'name',
        value: 'test,Inc',
      },
    ],
  },
  options,
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I need to do something with "name" property?&lt;/P&gt;&lt;P&gt;Hope someone tells me the way to work it out.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Mar 2023 05:11:10 GMT</pubDate>
    <dc:creator>egami</dc:creator>
    <dc:date>2023-03-09T05:11:10Z</dc:date>
    <item>
      <title>Form submission error when form contains company property</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Form-submission-error-when-form-contains-company-property/m-p/766283#M62076</link>
      <description>&lt;P&gt;I submitted form data to a HubSpot form using &lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/submit_form" target="_blank" rel="noopener"&gt;this&lt;/A&gt; endpoint.&lt;/P&gt;&lt;P&gt;However, error occurred when the form contains company property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My form fields are as follows:&lt;/P&gt;&lt;P&gt;・lastname&lt;/P&gt;&lt;P&gt;・firstname&lt;/P&gt;&lt;P&gt;・email&lt;/P&gt;&lt;P&gt;・phone&lt;/P&gt;&lt;P&gt;・name (Company property)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Only "name" which is company name, is company property and the rest are all contact property.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const options = {
  headers: {
    'Message-Type': 'application/json',
  },
};

const portalId = 'xxxxx';
const formGuid = 'xxxxx';
const url = `https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formGuid}`;

await axios.post(
  url,
  {
    portalId,
    formGuid,
    fields: [
      {
        name: 'lastname',
        value: 'test1',
      },
      {
        name: 'firstname',
        value: 'test2',
      },
      {
        name: 'email',
        value: 'test@example.com',
      },
      {
        name: 'phone',
        value: 0801234567,
      },
      {
        name: 'name',
        value: 'test,Inc',
      },
    ],
  },
  options,
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I need to do something with "name" property?&lt;/P&gt;&lt;P&gt;Hope someone tells me the way to work it out.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 05:11:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Form-submission-error-when-form-contains-company-property/m-p/766283#M62076</guid>
      <dc:creator>egami</dc:creator>
      <dc:date>2023-03-09T05:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Form submission error when form contains company property</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Form-submission-error-when-form-contains-company-property/m-p/766608#M62106</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/532831"&gt;@egami&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for your question. One difference in your JSON body example from what the documentation shows is the use of&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;"objectTypeId"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;Can you try setting the objectTypeID for each of your fields? For Contact properties it's 0-1 and for Company properties it's 0-2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;"fields": [
        {
		  "objectTypeId": "0-1",
          "name": "email",
          "value": "example@example.com"
        },
        {
		  "objectTypeId": "0-2",
          "name": "name",
          "value": "HubSpot"
        }
      ]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a link to the &lt;A href="https://developers.hubspot.com/docs/api/crm/crm-custom-objects#:~:text=When%20creating%20a%20new%20association%20between%20two%20custom%20objects%2C%20specify%20the%20custom%20objects%20by%20their%20objectTypeId%20in%20the%C2%A0toObjectTypeId%20field.%20For%20standard%20objects%2C%20you%20can%20identify%20them%20by%20name%20or%20use%20the%20following%20values%3A%C2%A0" target="_blank" rel="noopener"&gt;objectIds for our default Objects&lt;/A&gt;, Contacts, Companies, Deals, etc.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have fun building! — Jaycee&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 16:41:13 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Form-submission-error-when-form-contains-company-property/m-p/766608#M62106</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-03-09T16:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Form submission error when form contains company property</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Form-submission-error-when-form-contains-company-property/m-p/767152#M62137</link>
      <description>&lt;P&gt;Thank you for the reply&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;Everything worked when I set&amp;nbsp;objectTypeId as you suggested!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 15:19:58 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Form-submission-error-when-form-contains-company-property/m-p/767152#M62137</guid>
      <dc:creator>egami</dc:creator>
      <dc:date>2023-03-10T15:19:58Z</dc:date>
    </item>
  </channel>
</rss>

