Merge Contacts fails when custom Contact Reference field allows Multi-Select
Overview
After creating a custom field for events, Merge Contacts no longer works. The custom field is Contact Reference with Multi-Select. During the merge process, the query UPDATE civicrm_value_custom_group_# SET custom_field_# = individual_cid_2 WHERE custom_field_# = individual_cid_1
fails because custom_field_# is a varchar.
Reproduction steps
- Create a custom field group for Events with a Contact Reference field set to Multi-Select
- Create an Event and add two Organization contacts to the custom field
- Select any two Individual contacts and Merge
Current behaviour
Browser - DB Error: unknown error
Log - [nativecode=1292 ** Truncated incorrect DOUBLE value: 'org_cid_1org_cid_2']
Expected behaviour
Contacts merged
Environment information
- Browser: Firefox 88.0 (64 bit)
- CiviCRM: 5.36.1
- PHP: 7.3.27_
- CMS: Drupal 7.80
- Database: MySQL 5.7.34
- Web Server: Apache
Comments
My use case is recording organizations that partner with us on events, hence the use of organization contacts in the custom field when reproducing the issue.