Gorgias logo
Gorgias logo

All articles

Rule Glossary: IF, AND, OR, and ELSEUpdated 4 months ago

These are high-level conditions that are used to determine the relations between more granular conditions in the broader structure of a Rule.



IF

Technically, the Rule can be created with only a trigger and an action, but we use the IF statement to determine the criteria for the Rule and when it can be applied. 

When IF is pressed again, a dropdown will show 3 different options (other than to delete that node): Add AND condition, Add OR condition, and Add ELSE statement.


AND

AND checks for all criteria to be met - if you have a message body is test, message sender email is [email protected], and created date of ticket is after 01/01/2021, all three of those criteria need to be met for this Rule to be triggered.


OR

OR checks if any of the criteria can be met - if you were to receive a ticket from [email protected], a message that was in the ticket says "testing" and it was created on 01/02/2021, the Rule will be applied because at least one of the conditions was met.


ELSE

With the ELSE statement, we can break down the Rule into different portions. The ELSE part can contain just different actions, or conditions on its own.

We'll be asking if the criteria in the first node have been met:

  • If they were, the Rule won't look at the ELSE statement. 
  • If they weren't, the Rule will check the ELSE statement. 

If we put message sender email is [email protected] AND message body is test THEN add tag test-1 ELSE add tag not-test, that means that the tickets will be either tagged as test-1 or not-test - depending on the sender email and the message body. 

If we put message sender email is [email protected] AND message body is test THEN add tag test-1 ELSE message sender email is [email protected] THEN add tag not-test, we have 3 scenarios: 

  • The tickets get tagged as test-1 if they're sent from [email protected] and the message is "test". 
  • The tickets get tagged as not-test if they come from [email protected] but their message is not "test". 
  • The Rule doesn’t trigger if the sender isn't [email protected]
Was this article helpful?
Yes
No