Changing a custom field from multiple choice to Text breaks the API
Overview
Changing a custom field from a multiple choice (Radio, Checkboxes, etc.) to a free-entry text box works, until you try to write to the custom field via the API.
Reproduction steps
- On a demo site, go to Administer » Customize Data and Screens » Custom Fields.
- In Constituent Information, edit the Most Important Issue field to have a Field Input Type of Single-line input field (text or numeric) and save.
- Attempt to use APIv3
Contact.create
to write a value to the field that wasn't in the original set of multiple-choice values.
Current behaviour
API Error - your value isn't an accepted value for this field.
Expected behaviour
A custom field with a data type of "String" and HTML type of "Text" should take any alphanumeric value.
Comments
Changing the HTML type doesn't remove the Option Group ID. While arguably the API code should ignore that, it seems more important that the data be correct.