Answers.Body: <p>It appears to be a bug, but temporary workaround fixes the issue (split the fields into two custom field groups). </p>
  
  <p>Bug report can be found here: <a href="https://lab.civicrm.org/dev/core/issues/1330" rel="nofollow noreferrer">https://lab.civicrm.org/dev/core/issues/1330</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-24T21:41:43.407Z
Answers.LastActivityDate: 2019-10-24T21:41:43.407Z
Answers.UserDisplayName: Kristine
Answers.Body: <p>I do not think it is because you have too many custom fields but it might well be that something is not totally right in your data? Ideally you should compare the values in the civicrm_custom_group and civicrm_custom_field tables with the actual data holding tables (in your example civicrm_value_care_init_69) and check if that is all correct.</p>
  
  <p>The error also suggest that there is a constraint, so you probably use a field type of contact entity reference somewhere? And perhaps that is not entirely correctly configured? It is hard to be sure with only the error message to go by :-)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-15T20:51:53.827Z
Answers.Text: For some reason, one of the fields must have been stuck processing because I deleted all 50 something custom fields from phpmyadmin and it now works. Thanks for the advice on checking the civicrm_custom_group and civicrm_custom_fields table.
Answers.UserDisplayName: Kristine
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-16T05:40:21.317Z
Answers.Text: Sorry, I actually think it might be a bug. Updating the post in case anyone can confirm.
Answers.UserDisplayName: Kristine
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-15T11:01:51.693Z
Answers.LastActivityDate: 2019-10-15T11:01:51.693Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>I'm having trouble updating custom fields in CiviCRM 5.15.1/Drupal. </p>
  
  <p><strong>UPDATE</strong>: I believe this is occurring because I have too many custom fields in a custom group_id. I was able to reproduce this error twice: created a custom group, added custom fields to it. Once the number of custom fields reaches 93, I can no longer edit new or existing fields. When editing custom fields, I get the error:</p>
  
  <pre><code>DB Constraint Violation - custom_group_id should possibly be marked as mandatory for CustomField,create API. If so, please raise a bug report.
  </code></pre>
  
  <p>I cannot delete the custom field through civicrm (only phpmyadmin). When trying to edit the custom field, the logo spins forever. Also, when I try to access certain cases, I get an error "case_id is not valid : 1."</p>
  
  <p>I know the issue is related to the custom fields/custom group because if I disable the custom group, I no longer have the case_id issue. Any ideas what is going on?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-16T12:12:28.757Z
Comments.Text: I wonder if this is similar to https://lab.civicrm.org/dev/core/issues/1191. It might be reaching a database join limit.
Comments.UserDisplayName: Demerit
Tags: <custom-fields>
Title: Deleting and Adding Custom Fields
ThreadText: # Deleting and Adding Custom Fields
  
  (Asked by: username_0 on 2019-10-15)
  
  I'm having trouble updating custom fields in CiviCRM 5.15.1/Drupal. 
  UPDATE: I believe this is occurring because I have too many custom fields in a custom group_id. I was able to reproduce this error twice: created a custom group, added custom fields to it. Once the number of custom fields reaches 93, I can no longer edit new or existing fields. When editing custom fields, I get the error:
  DB Constraint Violation - custom_group_id should possibly be marked as mandatory for CustomField,create API. If so, please raise a bug report.
  
  I cannot delete the custom field through civicrm (only phpmyadmin). When trying to edit the custom field, the logo spins forever. Also, when I try to access certain cases, I get an error "case_id is not valid : 1."
  I know the issue is related to the custom fields/custom group because if I disable the custom group, I no longer have the case_id issue. Any ideas what is going on?
  
  **Tags:** custom-fields
  
  > **Comments:**
  > **username_1**: I wonder if this is similar to https://lab.civicrm.org/dev/core/issues/1191. It might be reaching a database join limit.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2019-10-24. Score: 1 | Accepted answer
  
  It appears to be a bug, but temporary workaround fixes the issue (split the fields into two custom field groups).
  
  Bug report can be found here: <https://lab.civicrm.org/dev/core/issues/1330>
  
  
  ---
  
  ### Answer by username_2 on 2019-10-15. Score: 2
  
  I do not think it is because you have too many custom fields but it might well be that something is not totally right in your data? Ideally you should compare the values in the civicrm\_custom\_group and civicrm\_custom\_field tables with the actual data holding tables (in your example civicrm\_value\_care\_init\_69) and check if that is all correct.
  
  The error also suggest that there is a constraint, so you probably use a field type of contact entity reference somewhere? And perhaps that is not entirely correctly configured? It is hard to be sure with only the error message to go by :-)
  
  > **Comments:**
  > **username_0**: For some reason, one of the fields must have been stuck processing because I deleted all 50 something custom fields from phpmyadmin and it now works. Thanks for the advice on checking the civicrm_custom_group and civicrm_custom_fields table.  
  > **username_0**: Sorry, I actually think it might be a bug. Updating the post in case anyone can confirm.  
  
  ---
  
  