Answers.Body: <p>There's an argument that the extension could mark the custom group reserved or prevent someone deleting it if it's required for the extension to function. If you uninstall and re-install the extension I expect now it would recreate the fields.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-20T17:02:02.567Z
Answers.LastActivityDate: 2022-05-20T17:02:02.567Z
Answers.UserDisplayName: Demerit
Body: <p>Deleted Custom Field set called Area and added a new custom field set called Regions and I get the below. I cannot access any Contacts now.</p>
  <pre><code>CiviCRM_API3_Exception: &quot;'group_areas' is not a valid option for field custom_group_id&quot;
  
  CiviCRM_API3_Exception: &quot;'group_areas' is not a valid option for field custom_group_id&quot;
  
  #0 /home/xxxxxxx/public_html/wp-content/uploads/civicrm/ext/org.civicoop.areas/CRM/Areas/Config.php(17): civicrm_api3(&quot;CustomField&quot;, &quot;getsingle&quot;, (Array:3))
  #1 /home/xxxxxxx/public_html/wp-content/uploads/civicrm/ext/org.civicoop.areas/CRM/Areas/Config.php(28): CRM_Areas_Config-&gt;__construct()
  #2 /home/xxxxxxx/public_html/wp-content/uploads/civicrm/ext/org.civicoop.areas/areas.php(75): CRM_Areas_Config::singleton()
  #3 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(283): areas_civicrm_fieldOptions(&quot;Contact&quot;, &quot;custom_35&quot;, (Array:0), (Array:1))
  #4 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook/WordPress.php(136): CRM_Utils_Hook-&gt;runHooks((Array:29), &quot;civicrm_fieldOptions&quot;, 4, &quot;Contact&quot;, &quot;custom_35&quot;, (Array:0), (Array:1), NULL, NULL)
  #5 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(249): CRM_Utils_Hook_WordPress-&gt;invokeViaUF(4, &quot;Contact&quot;, &quot;custom_35&quot;, (Array:0), (Array:1), NULL, NULL, &quot;civicrm_fieldOptions&quot;)
  #6 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(214): Civi\Core\CiviEventDispatcher::delegateToUF(Object(Civi\Core\Event\GenericHookEvent), &quot;hook_civicrm_fieldOptions&quot;, Object(Civi\Core\CiviEventDispatcher))
  #7 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(44): Symfony\Component\EventDispatcher\EventDispatcher-&gt;doDispatch((Array:1), &quot;hook_civicrm_fieldOptions&quot;, Object(Civi\Core\Event\GenericHookEvent))
  #8 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(198): Symfony\Component\EventDispatcher\EventDispatcher-&gt;dispatch(&quot;hook_civicrm_fieldOptions&quot;, Object(Civi\Core\Event\GenericHookEvent))
  #9 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(167): Civi\Core\CiviEventDispatcher-&gt;dispatch(&quot;hook_civicrm_fieldOptions&quot;, Object(Civi\Core\Event\GenericHookEvent))
  #10 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(1002): CRM_Utils_Hook-&gt;invoke((Array:4), &quot;Contact&quot;, &quot;custom_35&quot;, (Array:0), (Array:1), NULL, NULL, &quot;civicrm_fieldOptions&quot;)
  #11 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomField.php(320): CRM_Utils_Hook::fieldOptions(&quot;Contact&quot;, &quot;custom_35&quot;, (Array:0), (Array:1))
  #12 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomField.php(1109): CRM_Core_BAO_CustomField-&gt;getOptions()
  #13 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomGroup.php(1930): CRM_Core_BAO_CustomField::displayValue(&quot;4&quot;, Object(CRM_Core_BAO_CustomField), 1805)
  #14 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Summary.php(56): CRM_Core_BAO_CustomGroup::buildCustomDataView(Object(CRM_Contact_Page_View_Summary), (Array:4), FALSE, NULL, NULL, NULL, 1805, 1)
  #15 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Summary.php(77): CRM_Contact_Page_View_Summary-&gt;preProcess()
  #16 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(319): CRM_Contact_Page_View_Summary-&gt;run((Array:3), NULL)
  #17 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem((Array:14))
  #18 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))
  #19 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke((Array:3))
  #20 /home/xxxxxxx/public_html/wp-includes/class-wp-hook.php(307): CiviCRM_For_WordPress-&gt;invoke(&quot;&quot;)
  #21 /home/xxxxxxx/public_html/wp-includes/class-wp-hook.php(331): WP_Hook-&gt;apply_filters(&quot;&quot;, (Array:1))
  #22 /home/xxxxxxx/public_html/wp-includes/plugin.php(474): WP_Hook-&gt;do_action((Array:1))
  #23 /home/xxxxxxx/public_html/wp-admin/admin.php(259): do_action(&quot;toplevel_page_CiviCRM&quot;)
  #24 {main}
  </code></pre>
  <p>NOTE: I disabled the Areas extension and it appears to have fixed things. I am leaving this open as I would like to find out what I am doing wrong or if it might be a code issue.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-19T23:38:39.760Z
Comments.Text: There's an argument that the extension could mark the custom group reserved or prevent someone deleting it if it's required for the extension to function. If you uninstall and re-install the extension I expect now it would recreate the fields.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-20T16:56:04.387Z
Comments.Text: @Demerit I believe your answer is the best that will come and completely solved my issue as I had Disabled and not Uninstalled. It fixed the issues I had and I simply added a custom field set to an existing area where it best applied. There is no Accept Answer yet and I will check it for this when it appears. Thanks again!
Comments.UserDisplayName: Paul Williams
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-20T17:02:13.217Z
Comments.Text: Ok thanks - I have copied into the answer box.
Comments.UserDisplayName: Demerit
Tags: <wordpress><custom-fields><api><groups>
Title: API3 Error Custom Fields
ThreadText: # API3 Error Custom Fields
  
  (Asked by: username_0 on 2022-05-19)
  
  Deleted Custom Field set called Area and added a new custom field set called Regions and I get the below. I cannot access any Contacts now.
  CiviCRM_API3_Exception: "'group_areas' is not a valid option for field custom_group_id"
  
  CiviCRM_API3_Exception: "'group_areas' is not a valid option for field custom_group_id"
  
  #0 /home/xxxxxxx/public_html/wp-content/uploads/civicrm/ext/org.civicoop.areas/CRM/Areas/Config.php(17): civicrm_api3("CustomField", "getsingle", (Array:3))
  #1 /home/xxxxxxx/public_html/wp-content/uploads/civicrm/ext/org.civicoop.areas/CRM/Areas/Config.php(28): CRM_Areas_Config->__construct()
  #2 /home/xxxxxxx/public_html/wp-content/uploads/civicrm/ext/org.civicoop.areas/areas.php(75): CRM_Areas_Config::singleton()
  #3 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(283): areas_civicrm_fieldOptions("Contact", "custom_35", (Array:0), (Array:1))
  #4 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook/WordPress.php(136): CRM_Utils_Hook->runHooks((Array:29), "civicrm_fieldOptions", 4, "Contact", "custom_35", (Array:0), (Array:1), NULL, NULL)
  #5 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(249): CRM_Utils_Hook_WordPress->invokeViaUF(4, "Contact", "custom_35", (Array:0), (Array:1), NULL, NULL, "civicrm_fieldOptions")
  #6 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(214): Civi\Core\CiviEventDispatcher::delegateToUF(Object(Civi\Core\Event\GenericHookEvent), "hook_civicrm_fieldOptions", Object(Civi\Core\CiviEventDispatcher))
  #7 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(44): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch((Array:1), "hook_civicrm_fieldOptions", Object(Civi\Core\Event\GenericHookEvent))
  #8 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(198): Symfony\Component\EventDispatcher\EventDispatcher->dispatch("hook_civicrm_fieldOptions", Object(Civi\Core\Event\GenericHookEvent))
  #9 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(167): Civi\Core\CiviEventDispatcher->dispatch("hook_civicrm_fieldOptions", Object(Civi\Core\Event\GenericHookEvent))
  #10 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(1002): CRM_Utils_Hook->invoke((Array:4), "Contact", "custom_35", (Array:0), (Array:1), NULL, NULL, "civicrm_fieldOptions")
  #11 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomField.php(320): CRM_Utils_Hook::fieldOptions("Contact", "custom_35", (Array:0), (Array:1))
  #12 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomField.php(1109): CRM_Core_BAO_CustomField->getOptions()
  #13 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomGroup.php(1930): CRM_Core_BAO_CustomField::displayValue("4", Object(CRM_Core_BAO_CustomField), 1805)
  #14 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Summary.php(56): CRM_Core_BAO_CustomGroup::buildCustomDataView(Object(CRM_Contact_Page_View_Summary), (Array:4), FALSE, NULL, NULL, NULL, 1805, 1)
  #15 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Summary.php(77): CRM_Contact_Page_View_Summary->preProcess()
  #16 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(319): CRM_Contact_Page_View_Summary->run((Array:3), NULL)
  #17 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem((Array:14))
  #18 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))
  #19 /home/xxxxxxx/public_html/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke((Array:3))
  #20 /home/xxxxxxx/public_html/wp-includes/class-wp-hook.php(307): CiviCRM_For_WordPress->invoke("")
  #21 /home/xxxxxxx/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters("", (Array:1))
  #22 /home/xxxxxxx/public_html/wp-includes/plugin.php(474): WP_Hook->do_action((Array:1))
  #23 /home/xxxxxxx/public_html/wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")
  #24 {main}
  
  NOTE: I disabled the Areas extension and it appears to have fixed things. I am leaving this open as I would like to find out what I am doing wrong or if it might be a code issue.
  
  **Tags:** wordpress, custom-fields, api, groups
  
  > **Comments:**
  > **username_1**: There's an argument that the extension could mark the custom group reserved or prevent someone deleting it if it's required for the extension to function. If you uninstall and re-install the extension I expect now it would recreate the fields.  
  > **username_0**: @username_1 I believe your answer is the best that will come and completely solved my issue as I had Disabled and not Uninstalled. It fixed the issues I had and I simply added a custom field set to an existing area where it best applied. There is no Accept Answer yet and I will check it for this when it appears. Thanks again!  
  > **username_1**: Ok thanks - I have copied into the answer box.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-05-20. Score: 2 | Accepted answer
  
  There's an argument that the extension could mark the custom group reserved or prevent someone deleting it if it's required for the extension to function. If you uninstall and re-install the extension I expect now it would recreate the fields.
  
  
  ---
  
  