What is the correct way to set a default value on rendering a form for custom values. The code below works for native fields, but not for custom fields (presumably because they are looked up through API calls.
This is the code I have so far:
function webform_membership_civicrm_buildForm($formName, &$form) {
if ($formName == 'CRM_Activity_Form_Activity') {
if (in_array($form->getAction(), array(CRM_Core_Action::ADD, CRM_Core_Action::UPDATE))) {
$defaults['custom_8_-1'] = 710;
$form->setDefaults($defaults);
}
}