APIs & Integrations

jmclaren
HubSpot Employee
HubSpot Employee

Announcement: Enhanced Field Validation

SOLVE

EDIT: This change has started to take effect. We'll be rolling this out gradually over the next week

What’s Changing?

HubSpot is changing how validation works on some commonly used fields for contacts, including the first and last name.  This change will look for values that are obviously not valid values for the fields.  

 

Why are we making this change?

This change should help HubSpot customers maintain a cleaner database by rejecting obviously wrong values from being added to properties. This change is also designed to help protect customers from attack. By restricting the values of commonly used fields, it makes it more difficult for attackers to inject potentially harmful values. 

 

What action is required?

For the vast majority of developers, no action is required. However if you are using the default fields for a purpose other than their original intent, you should create a custom property to hold this information.

 

When will this change take place?

This change will take effect on February 26, 2020. 

 

If you have any questions, join the discussion below. 

Jon McLaren

Sr. CMS Developer Advocate

Get started developing on the HubSpot CMS Developer Changelog
How to optimize your CMS Hub site for speed

If my reply answered your question, please mark it as a solution, to make it easier for others to find.

1 Accepted solution
jmclaren
Solution
HubSpot Employee
HubSpot Employee

Announcement: Enhanced Field Validation

SOLVE

Unfortunately we can't provide the pattern/code which is used to validate values.
While understandable to want that as an integrator, we would them be also providing that information to spammers or bad actors defeating the purpose.

What I can tell you is the validation is looking for obvious wrong answers. Without explicitly stating a real example. Imagine you have a number field, and someone submits letters. That would be an example of an obviously wrong answer. 


Jon McLaren

Sr. CMS Developer Advocate

Get started developing on the HubSpot CMS Developer Changelog
How to optimize your CMS Hub site for speed

If my reply answered your question, please mark it as a solution, to make it easier for others to find.

View solution in original post

12 Replies 12
davidwork7
Participant

Announcement: Enhanced Field Validation

SOLVE

Dr.ing
D.Med
D.med
Dr.me
Dr.med.

above all text when i add in Firstname all time API give error

 

Can you give list or format which conider as Invalid TEXT

how can we ideantify its not valid text ?

MFrankJohnson
Thought Leader

Announcement: Enhanced Field Validation

SOLVE

Any word on ...

- Which properties will be impacted specifically?

- Examples of the new validation rules?

- What "obviously wrong values" might be rejected?

 

Thanks in advance.

 

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com
jmclaren
HubSpot Employee
HubSpot Employee

Announcement: Enhanced Field Validation

SOLVE

Hi Frank, 

 

Good questions, affected fields/properties are standard HubSpot default fields.
An example of both a validation rule and obviously wrong value, would be if you have a first name field and a URL or code was entered instead. 

 

If you have been intentionally storing data this way we would advise using new custom properties rather than abusing the default properties.

Jon McLaren

Sr. CMS Developer Advocate

Get started developing on the HubSpot CMS Developer Changelog
How to optimize your CMS Hub site for speed

If my reply answered your question, please mark it as a solution, to make it easier for others to find.

andreub
Participant

Announcement: Enhanced Field Validation

SOLVE

Hi jmclaren,

 

would it be possible to obtain a description of the pattern or algortithm that determines the validity of values, so that we can know beforehand whether a value will be accepted by the API or not?

 

Cheers

0 Upvotes
jmclaren
Solution
HubSpot Employee
HubSpot Employee

Announcement: Enhanced Field Validation

SOLVE

Unfortunately we can't provide the pattern/code which is used to validate values.
While understandable to want that as an integrator, we would them be also providing that information to spammers or bad actors defeating the purpose.

What I can tell you is the validation is looking for obvious wrong answers. Without explicitly stating a real example. Imagine you have a number field, and someone submits letters. That would be an example of an obviously wrong answer. 


Jon McLaren

Sr. CMS Developer Advocate

Get started developing on the HubSpot CMS Developer Changelog
How to optimize your CMS Hub site for speed

If my reply answered your question, please mark it as a solution, to make it easier for others to find.

andreub
Participant

Announcement: Enhanced Field Validation

SOLVE

This is aggravated by the fact that the error message is not easily parseable. If you update several contacts in batch and one of them contains an "obviously wrong" name, the error response will tell you which field was the offending one, but not of which contact. As far as we've seen, the only way to find exactly which name has a problem is to parse the error message, which used to say "\"foo.bar\" contains a URL". Now the message changed to "foo.bar contains a URL" (note no quotes anymore) and that broke our workaround.

 

So, if the API is going to reject input following unpublished rules, it'd be nice if at least the rejection message follows a standard format so we can do something about that.

0 Upvotes
AHazelton
Member

Announcement: Enhanced Field Validation

SOLVE

Is there a way to perform some validation prior to creating the contact so that the user can update the input prior to submitting the request?  For our integration, the Hubspot contact creation happens later on in our workflow after our own validation is performed.  Without providing any validation rules, we have no way of knowing if this step is going to be successful.  Please either make this feature optional or provide some way of validating the input without creating the contact.

PCronin9
Contributor

Announcement: Enhanced Field Validation

SOLVE

I found this surprising; at least for our use case. Are any of the "obviously wrong" characteristics being checked for on the list of falsehoods programmers believe about names? From our perspective, if someone says their name just happens to also parse as a hostname, that's fine, it's not our business to tell them they can't have that name. I guess using a custom property to replace HubSpot's name field will work for our organization, but it'd be lovely if the things a text field called "name" won't accept were at least described somewhere in the API docs so that a lot of trial an error on the part of many integrators could be saved.

adriano-azos
Participant

Announcement: Enhanced Field Validation

SOLVE

Does this mean that if I set the pattern attribute on input by javascript, it does not work inside the HubSpot form?
I'm trying a lot an input with a pattern that doesn't work.

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Announcement: Enhanced Field Validation

SOLVE

Thanks for the extra details @jmclaren 🙌 – Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
TheresaB
Participant | Diamond Partner
Participant | Diamond Partner

Announcement: Enhanced Field Validation

SOLVE

I am having issues with one of my clients because prospects are not all including their area code when inputting a phone number.  Is there any way for phone numbers to be validated?

0 Upvotes
jmclaren
HubSpot Employee
HubSpot Employee

Announcement: Enhanced Field Validation

SOLVE

Hey there, understand the frustration. If you're using the API and collecting the phone number yourself I recommend building your integration so that it requires the user to submit an area code.

Client-side a helpful thing you can do is visually indicate to the user that the field is not complete when they leave off the area code. this can be done with the html `tel` input and CSS :invalid
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/tel

Jon McLaren

Sr. CMS Developer Advocate

Get started developing on the HubSpot CMS Developer Changelog
How to optimize your CMS Hub site for speed

If my reply answered your question, please mark it as a solution, to make it easier for others to find.

0 Upvotes