API4 Custom fields: problem if same field name used in two custom groups
Overview
In API4 custom fields are referred to as eg 'Custom_Group1.Custom_Field1'.
If the same custom field name is used in two custom field groups, API4 gets confused and updates to the field in the second group are either wrongly applied to the field in the first group, or have no effect.
Reproduction steps
-
Create a custom field group 'CustomGroup1' used for Individuals and custom field 'myfield' (alpha text)
-
Create a custom field group 'CustomGroup2' used for Individuals and custom field 'myfield' (alpha text)
-
Use API4 to set 'CustomGroup1.myfield' to 'hello' - works as expected
-
Use API4 to set 'CustomGroup2.myfield' to 'world' - Observe that the wrong field is updated: 'CustomGroup1.myfield' is changed to 'world', no change to CustomGroup2.myfield
Note that if the CustomGroups are used for different purposes and only the second group is applicable, attempts to update its field have no effect.
Environment information
- CiviCRM: master Verified on dmaster.demo.civicrm.org