4

I feel like I've hit this issue before and found a solution, but I'm drawing a blank right now. I need to be able to compare the value of a custom data field before it's saved in order to conditionally perform another action. For core fields I would typically do this with the pre hook -- as you can look up the existing value and compare with the value passed in the hook. But the pre hook is not hit with custom value updates (why?), and the custom hook is hit after the data is saved, so you can't compare with the prior value (it's basically the equivalent of the post hook, specific to custom data).

I'd rather not work with form hooks, as I want this to be universally triggered without me needing to track down all the forms where the data might be potentially updated.

Any suggestions?

3

Not as far as I know. You could, however, apply this patch, which introduces generic preInsert and preUpdate hooks to CiviCRM. The copy and demo code for PR explains how you can use these hooks.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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