Answers.Body: <p>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:</p>
  
  <pre><code>if ($form-&gt;_action == CRM_Core_Action::ADD) {
    try {
      $normaal = (int) civicrm_api3('OptionValue', 'getvalue', [
         'return' =&gt; "value",
         'option_group_id' =&gt; "priority",
         'name' =&gt; "Normal",
      ]);
      $defaults['priority_id'] = $normaal;
      $form-&gt;setDefaults($defaults);
    }
    catch (CiviCRM_API3_Exception $ex) {
      Civi::log()-&gt;warning(E::ts('Onverwachte fout: geen prioriteit met naam Normal gevonden in ') . __METHOD__ . E::ts(', foutmelding van API OptionValue getvalue: ') . $ex-&gt;getMessage());
  </code></pre>
  
  <p>}
  }</p>
  
  <p>More information on the buildForm can be found here: <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/</a></p>
  
  <p>Does this make sense?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-31T12:40:13.913Z
Answers.LastActivityDate: 2019-12-31T12:40:13.913Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>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. </p>
  
Tags: <option><actions>
Title: how can I set the default value for the field "priority" in the actions form?
ThreadText: # how can I set the default value for the field "priority" in the actions form?
  
  (Asked by: username_0 on 2019-12-31)
  
  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.
  
  **Tags:** option, actions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-12-31. Score: 2
  
  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;
      $form->setDefaults($defaults);
    }
    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?
  
  
  ---
  
  