My CiviCRM 5.56.1 runs on Drupal 7.
I try to set the default value for a custom field which is used for an Action.
I created the field in Admin -> Customized Data & Screen -> Custom Fields. The field custom_76_-1
is shown in the form, and it works, I can change the current value. This is a date field showing a year-value only, and I'd like to set it's default value from current year to 3 years before (eg. in this year from 2022 to 2019). On the UI I can set a fix date, not a relative date.
With Javascript / jQuery I can change the shown value of the year, but not the default value in the form. I tried to set the default value in the form with the code from this https://civicrm.stackexchange.com/a/33474/5877 answer, but it doesn't works for me -- I mean the default value didn't changed. As I understood, custom fields are created from an AJAX call's response, and the buildForm()
function runs earlier as the AJAX call, which creates the custom field, so the default value can't be set (is this true or do / understand I something wrong?).
Please advice me how can I set the field's default value.