[regression](for real this time) API doesn't allow passing option values by label
This is best replicated from the CLI.
In Civi 5.25 and below, when you use the API create
action to modify a multiple-choice custom field (e.g. radio, checkboxes, etc.) you can pass either the OptionValue's value
or label
. Passing a label no longer works. For example, on a site with the standard demo data, custom field 6 is a question, "How long have you been a donor?" Here are the potential options:
mysql> select label, value from civicrm_option_value WHERE option_group_id=99;
+-------------------+-------+
| label | value |
+-------------------+-------+
| Less than 1 year | 1 |
| 1-3 years | 2 |
| 4-6 years | 3 |
| 7-9 years | 4 |
| More than 9 years | 5 |
+-------------------+-------+
In Civi 5.25 and below, the following commands are equivalent:
cv api Contribution.create id=1 custom_6='1-3 years'
cv api Contribution.create id=1 custom_6=2
However, in Civi 5.26, if you run the first command, instead you get:
{
"error_field": "custom_6",
"error_code": 2001,
"entity": "Contribution",
"action": "create",
"is_error": 1,
"error_message": "'1-3 years' is not a valid option for field custom_6"
}
git bisect
tracks it down to this commit (attention @colemanw). Further testing tracks it down to the change in CRM/Core/BAO/CustomField.php
; reverting that line fixes this.