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",&...
Pradeep Nayak's user avatar
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 ...
Coleman's user avatar
  • 18.6k
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 &$...
Coleman's user avatar
  • 18.6k
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. ...
Demerit's user avatar
  • 22.9k
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') -&...
Pradeep Nayak's user avatar
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.
Demerit's user avatar
  • 22.9k

Only top scored, non community-wiki answers of a minimum length are eligible