When adding a Condition to a CiviRule one can specify whether it is Adned or ORed with the previous one. If you enter a mixed sequence of AND and OR, what is the algorithm for combining them, since there is no bracketing available. Are they applied one at a time to the previously calculated answer, or what?

Thank you, Tony

2 Answers 2


Someone else I asked replied "I've not tried that, but the relevant code seems to be here: https://lab.civicrm.org/extensions/civirules/blob/master/CRM/Civirules/Engine.php#L235

That evaluates the conditions in order and at each step updates isValid based on its value so far and the next condition, so the result is: (((condition1 and/or condition2) and/or condition3) and/or condition4) etc"

I tried a couple of cases and that is indeed how it worked.

The result of mixing AND and OR may not be specified, or any particular behaviour supported, but there seems nothing to prevent one actually building a rule like that.


  • 1
    If it works fine, but as stated it is not supported in any way :-) As one of the originators of this extension: it does not work by intent :-) Nov 25, 2019 at 11:04

They do not. You can only use a combination of AND or a combination of OR, you can not mix them.

If you want a complicated condition you might contemplate building you own condition, documentation on how to can be found here: https://docs.civicrm.org/civirules/en/latest/create-your-own-condition/

Your Answer

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