Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.5
-
Fix Version/s: 4.6
-
Component/s: CiviCRM API
-
Labels:
-
Documentation Required?:None
Description
If you use the api to create a custom field, like
$api_result = civicrm_api3('CustomField', 'create', array(
'custom_group_id' => 10, // some existing custom group ID
'name' => 'voorkeursafdeling',
'label' => 'Voorkeursafdeling',
'data_type' => 'String',
'html_type' => 'Select',
'is_required' => 0,
'is_searchable' => 1,
'weight' => 2,
'is_active' => 1,
'option_group_id' => 92, // some existing option group id
));
it ignores the option_group_id, and just creates a new (empty) option group. You can work around this problem by updating the custom field after creation:
$custom_field_id = $api_result['id'];
civicrm_api3('CustomField', 'create', array(
'id' => $custom_field_id,
'option_group_id' => 92));
Attachments
Issue Links
- is duplicated by
-
CRM-15843 When creating customField via the API, can't set option_group_id
- Done/Fixed