When you set a default value for a custom field, it only exists at the form level. Is there a practical way to enforce them at the database level? For instance, by altering the SQL table definition?

I understand that a custom field record isn't created under every circumstance, but if I account for that (e.g. another custom field in that group is always populated) is altering the SQL practical?


A possible downside, although unlikely, is an upgrade might do some kind of batch modify on all custom fields that would wipe your default value.

What are you trying to do that can't be done with a hook or trigger?


Hang on, there is a default_value column in the civicrm_custom_field table? I would assume changing that value would actually work....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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