4
votes
Accepted
Populate a Contribution form custom field from a URL parameter
You can do something like below
you can use API4 to get the exact machine names
civicrm/api4#/explorer/CustomField/get?select=%5B"id"%5D&where=%5B%5B"name","%3D",&...
3
votes
Triggering hooks upon quick edits
Stored computed fields can be tricky because if you miss an update the stored value will be outdated. Implementing pre/post hooks should catch most updates that go through the UI and API, but of ...
3
votes
Accepted
civicrm_api3('Contact', 'create', in hook_civicrm_pre?
Running a contact update from within a contact update will cause an infinite loop. Instead of firing a new update action, just adjust the parameters of the action that's already happening. The &$...
3
votes
Accepted
civicrm_post hook not firing upon contact creation
The hooks run in php not javascript, so it won't log anything to the js console.
If you want to log, use \Civi::log()->debug('hello'); and then look in the ConfigAndLog directory in the logs there.
...
2
votes
How to generate field values on save
You can either do it pre() or PostProcess() hook
In postProcess hook you can call below API to update case id 34
\Civi\Api4\CiviCase::update(TRUE)
->addValue('subject', 'Your custom value')
-&...
1
vote
Accepted
CDNTaxReceipts extend $pdf_variables[]
If you look a few lines down from there it calls hook_cdntaxreceipts_writeReceipt where you can do something custom. There is also hook_cdntaxreceipts_alter_receipt as described in the readme.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
hooks × 148extension × 25
api × 17
custom-fields × 14
developer × 14
wordpress × 10
drupal × 9
forms × 8
civievent × 7
php × 7
webform-civicrm × 6
email × 6
civimember × 5
relationships × 5
civicontribute × 4
civimail × 4
civicase × 4
activities × 4
permissions × 4
contribution-page × 4
tokens × 4
ajax × 4
profile × 3
database × 3
groups × 3