APIs & Integrations

lgo
Member

Error with hubspot forms API

Hello,

 

I am having a weird problem I wonder if anyone can help me with.

 

I have a form that returns 2 different errors intermittently on submit, even when data is exactly the same.

errorType: "FIELD_NOT_IN_FORM_DEFINITION"
message: "Error in 'fields.phone'. Field 'phone' isn't in form definition"

or

message: "Invalid input JSON on line 1, column 894: Cannot build PublicApiCommunicationConsent, some of required attributes are not set [value]"
status: "error"

is anyone able to help me shed some light on why this could be happening? I have checked the "internal name" for phone and it is definitely 'phone'.

The second error occurs even though every value is set.

If I delete 'phone' from the form it submits as expected. If I leave phone blank, sometimes the form submits, sometimes I get the second error from above.

 

The phone field is a dependent field if that makes a difference

0 Upvotes
2 Replies 2
dennisedson
HubSpot Product Team
HubSpot Product Team

Error with hubspot forms API

@lgo 

Could you post your code that you are using?

@piersg , any thoughts here?

Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show
0 Upvotes
lgo
Member

Error with hubspot forms API

Hi,

I think I found the reason. We had two fields with the same name, "phone", one which is a "contact" property and the other a "organisation" property, the form is meant to collect "contact" data with all of the fields being of that type. The person who built the form had accidently selected "organisation" phone... it's since been changed to the correct property type and the form works as expected.

 

The error messages had me thinking it was at code level so a bit unhelpful - if there's anyway to get more helpful error codes that would be great but at least it's sorted!

 

Thanks so much for replying!