Answers.Body: <p>The custom field wasn't created properly at the initial stage hence it is causing problems to delete now.</p>
  <p>If you have access to the database you can delete using below query</p>
  <pre><code>DELETE FROM civicrm_custom_field WHERE id = 123;
  </code></pre>
  <p>Replace 123 with custom field ID</p>
  <p>HTH</p>
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-16T12:50:01.103Z
Answers.LastActivityDate: 2022-09-16T12:50:01.103Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I'm not sure if it's a bug but when I try to delete a custom field it shows me a loading <strong>screen that never finishes</strong>.</p>
  <p><a href="https://i.sstatic.net/a0GUO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/a0GUO.png" alt="enter image description here" /></a></p>
  <p>Additionally if I enable this custom data set for the contact and if I need to see the contact it shows me the following <strong>error</strong></p>
  <p>PEAR_Exception: DB Error: no such field in /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php on line 922</p>
  <ul>
  <li><p>DB_Error: DB Error: no such field in unknown on line unknown</p>
  <pre><code> 0    CRM_Core_Error::exceptionHandler()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:922
   1    PEAR_Error-&gt;__construct()   /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php:997
   2    DB_Error-&gt;__construct() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:575
  3 PEAR::_raiseError() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:223
  4 PEAR-&gt;__call()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php:1928
  5 DB_common-&gt;raiseError() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php:936
  6 DB_mysqli-&gt;mysqliRaiseError()   /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php:406
  7 DB_mysqli-&gt;simpleQuery()    /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php:1234
  8 DB_common-&gt;query()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php:2696
  9 DB_DataObject-&gt;_query() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php:1829
  10    DB_DataObject-&gt;query()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php:472
  11    CRM_Core_DAO-&gt;query()   /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php:1637
  12    CRM_Core_DAO::executeQuery()    /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomGroup.php:783
  13    CRM_Core_BAO_CustomGroup::buildTreeEntityDataFromQuery()    /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomGroup.php:732
  14    CRM_Core_BAO_CustomGroup::buildEntityTreeSingleFields() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomGroup.php:621
  15    CRM_Core_BAO_CustomGroup::getTree() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Summary.php:53
  16    CRM_Contact_Page_View_Summary-&gt;preProcess() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Summary.php:77
  17    CRM_Contact_Page_View_Summary-&gt;run()    /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:319
  18    CRM_Core_Invoke::runItem()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69
  19    CRM_Core_Invoke::_invoke()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36
  20    CRM_Core_Invoke::invoke()   /bitnami/wordpress/wp-content/plugins/civicrm/civicrm.php:1199
  21    CiviCRM_For_WordPress-&gt;invoke() /opt/bitnami/wordpress/wp-includes/class-wp-hook.php:307
  22    WP_Hook-&gt;apply_filters()    /opt/bitnami/wordpress/wp-includes/class-wp-hook.php:331
  23    WP_Hook-&gt;do_action()    /opt/bitnami/wordpress/wp-includes/plugin.php:476
  24    do_action() /opt/bitnami/wordpress/wp-admin/admin.php:259
  </code></pre>
  </li>
  </ul>
  <p><a href="https://i.sstatic.net/NoKq5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NoKq5.png" alt="enter image description here" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-14T17:09:51.917Z
Comments.Text: Hi Suri!  When posting these issues, it's best to include the text and not just a screenshot - it's easier for folks to search, and accessible to blind folks.  It's also best to include the full debug and backtrace: Enable at **Administer menu » System Settings » Debugging and Error Handling**. Finally, the screen that never finishes won't show an error on-screen.  If you know how to use the Developer toolbar Network tab, you can find the error in the AJAX response. Otherwise check the CiviCRM logs: See the top two answers on https://civicrm.stackexchange.com/q/15931/12 and edit your question?
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-15T04:42:42.750Z
Comments.Text: also if you disable pop-ups, or right click the link for Delete Field, then instead of just spinning you may get additional information - not necessarily in this case but as a general rule
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-15T16:56:52.830Z
Comments.Text: Thank you for posting the backtrace - but I don't see the accompanying (extended) error message, which should include a SQL statement and the SQL error that caused it.  My guess though?  When you create a custom field group, it creates both a record in civicrm_custom_group and a new table (starting with `civicrm_value_`.  Creating a custom field creates both a record in `civicrm_custom_field` and also a column in the corresponding table.  This error may occur if those get out of sync - e.g. if you delete one manually without the other, or you partially restore a database.
Comments.UserDisplayName: Jon G - Megaphone Tech
Tags: <wordpress><contacts><custom-fields>
Title: Error when trying to delete custom fields
ThreadText: # Error when trying to delete custom fields
  
  (Asked by: username_0 on 2022-09-14)
  
  I'm not sure if it's a bug but when I try to delete a custom field it shows me a loading screen that never finishes.
  
  Additionally if I enable this custom data set for the contact and if I need to see the contact it shows me the following error
  PEAR_Exception: DB Error: no such field in /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php on line 922
  
  DB_Error: DB Error: no such field in unknown on line unknown
   0    CRM_Core_Error::exceptionHandler()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:922
   1    PEAR_Error->__construct()   /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php:997
   2    DB_Error->__construct() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:575
  3 PEAR::_raiseError() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:223
  4 PEAR->__call()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php:1928
  5 DB_common->raiseError() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php:936
  6 DB_mysqli->mysqliRaiseError()   /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php:406
  7 DB_mysqli->simpleQuery()    /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php:1234
  8 DB_common->query()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php:2696
  9 DB_DataObject->_query() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php:1829
  10    DB_DataObject->query()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php:472
  11    CRM_Core_DAO->query()   /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php:1637
  12    CRM_Core_DAO::executeQuery()    /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomGroup.php:783
  13    CRM_Core_BAO_CustomGroup::buildTreeEntityDataFromQuery()    /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomGroup.php:732
  14    CRM_Core_BAO_CustomGroup::buildEntityTreeSingleFields() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomGroup.php:621
  15    CRM_Core_BAO_CustomGroup::getTree() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Summary.php:53
  16    CRM_Contact_Page_View_Summary->preProcess() /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Summary.php:77
  17    CRM_Contact_Page_View_Summary->run()    /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:319
  18    CRM_Core_Invoke::runItem()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69
  19    CRM_Core_Invoke::_invoke()  /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36
  20    CRM_Core_Invoke::invoke()   /bitnami/wordpress/wp-content/plugins/civicrm/civicrm.php:1199
  21    CiviCRM_For_WordPress->invoke() /opt/bitnami/wordpress/wp-includes/class-wp-hook.php:307
  22    WP_Hook->apply_filters()    /opt/bitnami/wordpress/wp-includes/class-wp-hook.php:331
  23    WP_Hook->do_action()    /opt/bitnami/wordpress/wp-includes/plugin.php:476
  24    do_action() /opt/bitnami/wordpress/wp-admin/admin.php:259
  
  **Tags:** wordpress, contacts, custom-fields
  
  > **Comments:**
  > **username_1**: Hi Suri!  When posting these issues, it's best to include the text and not just a screenshot - it's easier for folks to search, and accessible to blind folks.  It's also best to include the full debug and backtrace: Enable at **Administer menu » System Settings » Debugging and Error Handling**. Finally, the screen that never finishes won't show an error on-screen.  If you know how to use the Developer toolbar Network tab, you can find the error in the AJAX response. Otherwise check the CiviCRM logs: See the top two answers on https://civicrm.stackexchange.com/q/15931/12 and edit your question?  
  > **username_2**: also if you disable pop-ups, or right click the link for Delete Field, then instead of just spinning you may get additional information - not necessarily in this case but as a general rule  
  > **username_1**: Thank you for posting the backtrace - but I don't see the accompanying (extended) error message, which should include a SQL statement and the SQL error that caused it.  My guess though?  When you create a custom field group, it creates both a record in civicrm_custom_group and a new table (starting with `civicrm_value_`.  Creating a custom field creates both a record in `civicrm_custom_field` and also a column in the corresponding table.  This error may occur if those get out of sync - e.g. if you delete one manually without the other, or you partially restore a database.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2022-09-16. Score: 0
  
  The custom field wasn't created properly at the initial stage hence it is causing problems to delete now.
  If you have access to the database you can delete using below query
  DELETE FROM civicrm_custom_field WHERE id = 123;
  
  Replace 123 with custom field ID
  HTH
  Pradeep
  
  
  ---
  
  