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?


2 Answers 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 :-)

  • 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.
    – Kristine
    Commented Oct 15, 2019 at 20:51
  • Sorry, I actually think it might be a bug. Updating the post in case anyone can confirm.
    – Kristine
    Commented Oct 16, 2019 at 5:40

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.