How would you recommend to check data change (with pre and post values) on a custom field (attached to a case) and then to mark an activity in that case as completed?

I have looked at hooks like hook_civicrm_custom and the _pre/_post hooks, but having difficulty getting this to work.

Thank you!

2 Answers 2


I am not sure if it can already do exactly what you want, but my advice is to first look at the CiviRules extension.


  • 2
    Catorghans, I just wanted to say thanks for the all answers you've been contributing lately! Much appreciated. Cheers, Joe
    – Joe Murray
    Commented Jan 23, 2016 at 21:22
  • Thanks for the suggestion. Yes, I had looked at CiviRules but found it didn't quite work as I needed. It works with the _post hook as a trigger. However I found another way to make this work. See below in the answers.
    – Piyush
    Commented Jan 26, 2016 at 16:28

I finally made this work by applying a modified version of the patch at https://issues.civicrm.org/jira/browse/CRM-9649 which adds an additional array of the previous values for all the custom fields to the hook_civicrm_custom hook.

There is also a plan to make the _pre and _post hooks consistent by including custom data fields (see https://issues.civicrm.org/jira/browse/CRM-15261). This will also solve the issue I had when done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.