Changing field from Multi-Select to Select seems to still be allowed -- but is broken
When editing a Multi-Select custom field in the GUI, there are two places where the interface is misleading/broken.
Edit Custom Field form
As of 5.27, "Multi-Select" is not its own HTML type; it is the "Select" type with the "serialize" marker set to true. On the "Edit Custom Field" form (CRM/Custom/Form/Field.php), "serialize" is represented by a checkbox labeled "Multi-Select". This checkbox can be unchecked, but the "serialize" marker is not changed after the form is submitted.
Change Field Type form
On the "Edit Custom Field" form, if the user clicks "Change Input Field Type", the "Change Field Type" form appears.
This form still lists "Multi-Select" as an option; it is not aware of the new "serialize" scheme. So the user can change the type to "Multi-Select".
If a field's HTML type is "Multi-Select" or "Checkbox", the user can choose to convert the field to "Select" (although this is marked "not safe"). As it has always done, Civi updates the custom field data so that there is only one option value per record, in unserialized form, but new code forces the "serialize" marker to stay true, which leads to problems editing field values.
- Create an "Alphanumeric" "Checkbox" custom field with more than one option.
- Edit a record that has the custom field; check off at least two options and save.
- Go back to the settings screen for the custom field; edit the field settings.
- Click "Change Input Field Type".
- Choose "Multi-Select" and save.
- Observe that "Data and Input Field" is now just "Alphanumeric" -- the HTML type is not shown. In the database, the field has "Multi-Select" as its html_type, but this form no longer recognizes that value.
- Click "Change Input Field Type" again.
- Choose "Select ( Not Safe )" and save.
- Observe the helpful warning, and click OK.
- Observe that "Multi-Select" is checked, despite the fact that we supposedly just changed the field type away from Multi-Select. This is because the custom field has "serialize" set to 1, left over from the "CheckBox" type.
- Uncheck "Multi-Select" and Save.
- Edit the field settings again.
- Observe that "Multi-Select" is now checked again, despite unchecking it and saving it.
- Go to the record where you entered data in the custom field before.
- Observe that just one of the options you checked before is listed. This is because you changed the field from Multi-Select to Select. It is expected behavior.
- Edit the record.
- Observe that no value is selected because the field data is now unserialized, but "serialize" was prevented from changing to 0, so Civi is confused. This is a regression.
The UI claims to allow conversion from multi-value (serialized) types to single-value (unserialized) types, and it does convert the custom data, but doesn't flip the "serialized" switch on the custom field itself, leaving both the data and the user confused.
You should be able to convert a multi-value field to a single-value field, as you have been able to do in Civi for years. Plenty of warning is provided that this is only something you should do if you take precautions.
After converting a field in this way, the remaining (single) custom field value should appear correctly on a record's edit form.
This feature being broken is a regression.