in my extension I have the need to manage a new contact information (I added a field in civicrm_contact, instead of using a custom field). Using the buildForm hook, I can show the input element in the contact form, but I don't know how to write the field value in the database. Is there a specific hook for this operation?

Thanks Marcello

2 Answers 2


There is no hook or api specifically for writing to a field added to the civicrm_contact table, as that is a bad unsupported hack to core. I'd suggest changing your code to use the support provided for custom fields. That way you can be more confident that a code review of the extension won't end up preventing it from being published on civicrm.org for auto-distribution. If you still want to proceed with this bad pattern, then you might want to consider writing SQL and submitting it via db_query.

  • Thanks' Joe. At the end I have followed the way you suggest.
    – marcello
    Commented Apr 11, 2016 at 5:34
  • Great! FWIW, I'd appreciate having the answer marked as accepted and even upvoted ;)
    – Joe Murray
    Commented Apr 11, 2016 at 21:04

Use the post hook on the Contact entity.

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.