Skip to content

Add original data flag for field value comparison condition

Patrick Figel requested to merge pfigel/civirules:add-original-comparison into master

We recently started playing around with CiviRules and are quite impressed so far. One use-case we couldn't get to work yet is a rule where we only run the action if a field was changed from value X to Y (in our case do_not_email = 0 -> 1).

This adds a new checkbox for the field value comparison condition to configure whether the comparison will be performed against the new entity data (default) or the original state. This allows for constructs like "Contact.do_not_email (original value) = 0 AND Contact.do_not_email = 1", which would only pass if the value was actively changed (and not just re-saved).

image

image

Happy to change the UI/wording or move this to a new condition type if you feel that would provide better UX.

Merge request reports