Understanding Conditions in Zenphi

Zenphi and many other no-code automation tools make life simpler by turning complex coding into intuitive drag-and-drop workflows. One key feature of these tools is the ability to create conditional logic, essentially, "if" statements.  

If Statements direct the flow of your automation based on specific criteria. In Zenphi, you use such conditions with the If Condition (and Switch) action.  However, there are a couple more places where you can use such conditions. In triggers, you can use the condition to start the execution of a flow only when certain conditions are met.

 In the action Query Collection, you can use conditions to obtain only items in the collection that meet the conditions.  But how do you set up these conditions, and how are they evaluated? Let's explore how you do this in Zenphi.

Conditional Rules in Zenphi

Conditional logic helps your automation decide what to do next. With an If  Condition, you can test variables or check statuses to trigger specific actions. For instance:

  • Zenphi sends an email only if a customer hasn’t responded.

  • A task is marked "Urgent" if the priority is high and the due date is today.

  • A file must be reviewed unless it’s been already reviewed.

Zenphi provides a visual interface where you can configure these conditions instead of writing code. You define the rules using dropdowns and fields, making it accessible even if you have no programming experience.

Logical Operators in Zenphi

Just like in traditional "if" statements, zenphi  relies  on the logical operators And, Or, and Except When to evaluate multiple conditions:

  • And means all conditions must be met for the action to trigger.

  • Or means any one condition can be met for the action to trigger.

  • Except When means it will exclude a specific condition, flipping its logic.

Setting Conditions in a Visual Interface

Instead of typing if (A=true and B=true and C=true), in zenphil, you'll use dropdowns and tokens (fields)  to achieve the same thing. Here’s how a specific setup might look:

When All Conditions Are True (AND)

Imagine you want a task to move to the "Completed" stage only if three criteria are true:

  • The task status is "Done."

  • The client has been notified.

  • The feedback has been received.

In Zenphi, you use an AND condition.  Configuring the rule in zenphi  looks like this:


Zenphi checks each condition; if all three are true, the process is continued with the actions in the true branch. But when only one is false, it will proceed in the false branch.

When Any Condition Is True (OR)

Let's say you want to send a follow-up reminder if any one of three things happens:

  • The task status is "Done."

  • The client has been notified.

  • The feedback has been received.

Here, you'd use an OR condition. It might look like this in the interface:


Zenphi checks each condition. If any one is true, the reminder is sent—even if the others are false.  Only when all conditions are false is no reminder sent.


Excluding Certain Conditions (Except When)

Now suppose you want to send a follow-up reminder email to all users except those who’ve already provided feedback. 

  • The task status is "Done."

  • The client has been notified.

  • The feedback has not been received.

You’d use the Except When operator, which reverses logic. Your rule will look like this:



By using "Except When" here, the automation excludes all users who have provided feedback, ensuring only users who have not provided feedback get the email.

When All Conditions Are False  (AND & Except When)

Now, suppose you want to send a follow-up reminder promotional email to all users except those who’ve already completed the task, have been notified, and provided feedback:  

  • The task status is not "Done."

  • The client has not been notified.

  • The feedback has not been received.

You’d use the Except When in combination with the AND operator, which reverses logic. Your rule will look like this:


By using "Except When" in combination with “And” here, Zenphi ensures only users who have not completed the task and haven't been notified and haven't provided feedback get the email.


Regular Mistake

A regular mistake is to get the opposite result of Any condition true then the condition is set as Any condition is not true. 

Let's suppose you (initially) want to send an email to users whose task status is either: "Done” or "InProgress" or  "Rejected".   In Zenphi, you would configure it like this:


However, (on second thought) you want to send the email to users whose task status is not "Done” nor "InProgress" nor "Rejected".  

You might be tempted to configure the condition like this: 


However, with this configuration, the flow will continue in the true branch when any of the conditions is true.  For example, assume that the Task Status is Done.  then the flow will continue the true branch and not in the false branch.

As expected, the first line (Except When Task Status is Equal to Done) will result in false.  However, the second and third line results are true.  And as any of the three conditions must be true, the overall condition is true, and the flow will continue in the true branch.

The correct configuration is this:


Common mix up

Now, suppose you want to send a notification  email to your manager for a task that is waiting and the client has been notified or the task assignee is on leave (Waiting AND Notified) OR On Leave:  

  • The task status is "Waiting."

  • The client has been “Notified”.

  • The task assignee is “On leave”.

You might be tempted to configure the condition like this: 


However, Zenphi will evaluate this  as:  Waiting AND (Notified OR On Leave), and will result in a “false false” (it should have been true), when:

  • The task status is not "Waiting."

  • The client has been “Notified”.

  • The task assignee is “On leave”.

And when:

  • The task status is not "Waiting."

  • The client has been not “Notified”.

  • The task assignee is “On leave”.

To obtain the intended result, the condition must be configured as follows (Waiting OR On Leave) AND (Notified OR On Leave) :


Summary

Understanding conditional logic is crucial for building effective automation in Zenphi. By using "If Conditions" and logical operators like "AND," "OR," and "Except When," you can control the flow of your automation based on specific criteria. 

Remember to set up your conditions carefully, avoiding common pitfalls like incorrectly negating conditions. With practice, you can leverage Zenphi's visual interface to create powerful automation without writing any code.