Some Multi-Select Custom Fields cannot be saved
The following Custom Field types cannot be saved in the CiviCRM UI nor via API v3:
- Integer Drop-down Multi-Select
- Number Drop-down Multi-Select
- Money Drop-down Multi-Select
They result in the following errors respectively:
One of parameters (value: *2*4*) is not of the type Timestamp
One of parameters (value: *2*4*) is not of the type Float
One of parameters (value: *2.99*3.99*1.99*) is not of the type Money
(Where the * characters above are actually
As per this discussion on MatterMost.
- Create a Custom Field of type
- Select the "Multi-Select" checkbox
- Add some values for the Select
Values cannot be saved in the CiviCRM UI nor via API v3, e.g.
$result = civicrm_api3('Contact', 'create', [ 'id' => 210, 'contact_type' => "Individual", 'custom_20' => [2, 4], ]);
Error messages as above.
The items in the "serialised array" should be checked for their respective types rather than testing the "serialised array" itself and, if valid, should be saved.
Found in CiviCRM 5.34.0 but almost certainly present since 5.27 and likely a result of this PR which introduced the "Multi-Select" checkbox for all Custom Fields of type "Select". Prior to 5.27
Money did not have a "Multi-Select" option.