Custom field type/validation changes and existing values failing update
SOLVE
I'm trying to get to the bottom of some wierd errors my clients keep getting. It looks like HubSpot CRM users can change a custom field type from one to another without existing fields being changed (until editing). At least, this is my assumption.
The backstory: We're trying to update a company with a field value that was fetched from the user account shortly before. We get a validation error that the enumeration or input type is not correct. Our latest example is a custom field value we pulled which is suppose to be an ID that has numbers and letters, on update we get a integer validation error because of the text. How could those invalid values exist if we're no longer allowed to update them with the same value?
This is what I need to know:
Can custom fields change type from say a very loose type like "text" to a stricter type like "integer"? If so, what would be the suggested maintenance to update existing values that contain text when such a custom field change is made?
Have there been any number field changes in the HubSpot API that would have caused existing field values to become invalid?
In which cases would we expect existing field values to be stored but not pass validation on update? How do we work around this?
This has been an issue for multiple customers now. I don't know who holds the burden of responsibility here. If it's ours I've love to know so we can fix it right away.
A HubSpot user can indeed change the type of a custom object property via the UI.
Following your example, if a custom company property with "type":"string" is changed in-app to "type":"number", then you as the integrator will no longer be able to write strings to the property, but the company's value will remain a string. HubSpot does its best to retain known values despite incompatible changes to the property's type.
I'll try to address each of your specific questions:
Yes, custom fields can change type. If you need to write a string back to that field, you must change the custom property's type back to string via the corresponding object properties API, undoing the in-app change.
There haven't been any recent changes to how HubSpot treats string and numbertype properties, and HubSpot would not programmatically change the types of custom object properties.
Per the first bullet point, all cases. The only way to work around this would be to undo any user changes to a property's type via API.
A HubSpot user can indeed change the type of a custom object property via the UI.
Following your example, if a custom company property with "type":"string" is changed in-app to "type":"number", then you as the integrator will no longer be able to write strings to the property, but the company's value will remain a string. HubSpot does its best to retain known values despite incompatible changes to the property's type.
I'll try to address each of your specific questions:
Yes, custom fields can change type. If you need to write a string back to that field, you must change the custom property's type back to string via the corresponding object properties API, undoing the in-app change.
There haven't been any recent changes to how HubSpot treats string and numbertype properties, and HubSpot would not programmatically change the types of custom object properties.
Per the first bullet point, all cases. The only way to work around this would be to undo any user changes to a property's type via API.
Custom field type/validation changes and existing values failing update
SOLVE
Thanks for the explination.
Th only way I can see this being fixed then is either we ignore that field or filter it based on the type provided in the fields list. Which is a bit of a pain and maybe not going to be very accurate.
I find it very odd HubSpot would allow users to change field types like this but not much we can do about it now except write some workarounds in the backend.
Thanks for the response. I appreciate you taking the time to go deep with this.