I want to force a default value for the field priority in the actions form, so that users don't have to pick the right value if the default value is OK.

1 Answer 1


Bernard, you can do this by developing a little extension and using the buildForm hook to set the default value of the priority. In the buildForm hook you can do something like this:

if ($form->_action == CRM_Core_Action::ADD) {
  try {
    $normaal = (int) civicrm_api3('OptionValue', 'getvalue', [
       'return' => "value",
       'option_group_id' => "priority",
       'name' => "Normal",
    $defaults['priority_id'] = $normaal;
  catch (CiviCRM_API3_Exception $ex) {
    Civi::log()->warning(E::ts('Onverwachte fout: geen prioriteit met naam Normal gevonden in ') . __METHOD__ . E::ts(', foutmelding van API OptionValue getvalue: ') . $ex->getMessage());

} }

More information on the buildForm can be found here: https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/

Does this make sense?

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.