The threads I have seen are from 2009...

Is there a solution for this in 2018?

Something that would dynamically set current date as default?

enter image description here


I am not sure if this is possible through UI configuration. The form only allows you to enter valid date but not now(), CURRENT_DATE() etc. However it is definitely possible by adding a small code in a extension.

  1. Create and enable a new CiviCRM extension
  2. Implement the hook_civicrm_buildForm in your extension

For the appropriate variable do:

function ext_civicrm_buildForm($formName, &$form) {
  if ($formName == 'REPLACE_WITH_FORMNAME') {
    $defaultDate = [];
    $defaults['custom_XXX'] = $defaultDate;
  • Thanks, but in what file do I input this code? What exact path? Oct 6 '18 at 22:30
  • You will need to create a extension using Civix and then implement the hook. Oct 6 '18 at 23:09
  • That sounds a little complicated...when I create a contact, on the bottom of the form is says: "Last Change by: Bruno Vincent (September 11th, 2018 4:43 PM) » " , now what I would like is a filed that shows up in views displaying a datecreated field, how could I do that? Oct 7 '18 at 0:25

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.