function onBeforeWrite() { parent::onBeforeWrite(); if (!$this->DispatchedOn) { $this->DispatchedOn = DBField::create_field('Date', date('Y-m-d')); } }