Answers.Body: <p>There are a few ways to delete a custom field other than the UI:</p>
  <ul>
  <li>Use the API Explorer and then entity CustomField / CustomGroup. That will allow you to delete them, but you will need to know the ID of the CustomField or CustomGroup. You can find that with the API Explorer as well. More info: <a href="https://docs.civicrm.org/dev/en/latest/api/#api-explorer" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/api/#api-explorer</a></li>
  <li>In the database, but will need to know exactly what you are doing! This is not something to recommend without a sound knowledge of the CiviCRM database. You have to make sure all the tables and data are correct and in sync with each other. There are a few tables involved:</li>
  <li>civicrm_custom_group, which holds the details of the custom group. One of the columns is the table_name, which will hold the name of the table where the actual custom data is</li>
  <li>civicrm_custom_field, which holds the details of the custom fields, linked with the column custom_group_id. One of the columns is column_name, which is the name of the column in the actual table with data</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-16T09:12:44.090Z
Answers.Text: Erik, thank you very much. It did not work with API Explorer v3.0, but went smoothly with API Explorer 4.0.
Answers.UserDisplayName: Aivars
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-16T14:24:38.280Z
Answers.Text: Happy to hear that!
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-16T07:51:28.153Z
Answers.LastActivityDate: 2021-03-16T07:51:28.153Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>I had a custom field group with a disabled field.</p>
  <ol>
  <li><p>When I tried to delete the field (ID=59), the Warning window froze with CRM logo rotating.</p>
  </li>
  <li><p>When I tried to enable the field, it gave Error about DB Constraint Violation, but apparently enabled the field.</p>
  </li>
  <li><p>When I tried to delete the field then, the Warning window froze again with CRM logo rotating.</p>
  </li>
  </ol>
  <p>The screenshot contains combined messages - error from action 2 and warning window from action 3.</p>
  <p>How can I fix the issue?</p>
  <p>P.S. Editing the field 59 does not work either (also frozen logo after clicking save).</p>
  <p><a href="https://i.sstatic.net/7Z3qI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7Z3qI.png" alt="enter image description here" /></a></p>
  <p>I am running CiviCRM 5 on Drupal 7.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-16T18:39:10.967Z
Comments.Text: as a hint. in such situations of spinning logo if instead you right-click and run the task in a separate tab/window you are more likely to see the error involved.
Comments.UserDisplayName: petednz - fuzion
Tags: <custom-fields><database>
Title: How can I delete a custom field (other than GUI)?
ThreadText: # How can I delete a custom field (other than GUI)?
  
  (Asked by: username_0 on 2021-03-16)
  
  I had a custom field group with a disabled field.
  
  1. When I tried to delete the field (ID=59), the Warning window froze with CRM logo rotating.
  2. When I tried to enable the field, it gave Error about DB Constraint Violation, but apparently enabled the field.
  3. When I tried to delete the field then, the Warning window froze again with CRM logo rotating.
  
  The screenshot contains combined messages - error from action 2 and warning window from action 3.
  
  How can I fix the issue?
  
  P.S. Editing the field 59 does not work either (also frozen logo after clicking save).
  
  [![enter image description here](https://i.sstatic.net/7Z3qI.png)](https://i.sstatic.net/7Z3qI.png)
  
  I am running CiviCRM 5 on Drupal 7.
  
  **Tags:** custom-fields, database
  
  > **Comments:**
  > **username_1**: as a hint. in such situations of spinning logo if instead you right-click and run the task in a separate tab/window you are more likely to see the error involved.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-03-16. Score: 2 | Accepted answer
  
  There are a few ways to delete a custom field other than the UI:
  
  * Use the API Explorer and then entity CustomField / CustomGroup. That will allow you to delete them, but you will need to know the ID of the CustomField or CustomGroup. You can find that with the API Explorer as well. More info: <https://docs.civicrm.org/dev/en/latest/api/#api-explorer>
  * In the database, but will need to know exactly what you are doing! This is not something to recommend without a sound knowledge of the CiviCRM database. You have to make sure all the tables and data are correct and in sync with each other. There are a few tables involved:
  * civicrm\_custom\_group, which holds the details of the custom group. One of the columns is the table\_name, which will hold the name of the table where the actual custom data is
  * civicrm\_custom\_field, which holds the details of the custom fields, linked with the column custom\_group\_id. One of the columns is column\_name, which is the name of the column in the actual table with data
  
  > **Comments:**
  > **username_0**: Erik, thank you very much. It did not work with API Explorer v3.0, but went smoothly with API Explorer 4.0.  
  > **username_2**: Happy to hear that!  
  
  ---
  
  