Tutorial

3 ways to add conditions to Zaps

  • 24 March 2023
  • 3 replies
  • 7098 views
3 ways to add conditions to Zaps
Userlevel 7
Badge +12

A common question we see in the Community is "can I set up a Zap that changes depending on the information from the trigger". This is called ‘conditional logic’, a process or action that changes if specific criteria are met. It's often described as ‘if/then’ or ‘if/else’ logic. 

In a Zap, conditional logic is useful in lots of situations:

  • Only send a voucher code if the buyer is a new customer

  • If the lead is hot, assign it to the sales team; if it’s cold, assign it to the nurture team.

  • If someone is interested in fostering animals, send them an information leaflet and book an appointment with them, if they are interested in adoption, send them an application form.

This article is for you if you know that you need conditional logic in your Zap but are unsure how to do it. We’ll cover different ways to add conditional logic into Zaps and explain the pros and cons of different approaches. 

The three ways of adding logic into your Zap that we will look at are Lookup Tables, Filters, and Paths. Each of these has its strengths, which you use will depend on your Zapier plan and what you want the Zap to do.

Lookup table

A lookup table matches an input to an output. A simple example of a lookup table is when you have someone’s name and look through a company directory to find their email address. That list allows you to match someone’s name to their email address.

You can create a Lookup Table using Formatter by Zapier.  We’re not going to go into detail abouthowto build a lookup table in this article, you can learn more about that in the help guide: Create Lookup Tables in Zaps

Let’s use a Lookup table in an example. Let’s say I own a plant shop, Ferntastic Finds, with an online shop and a physical store. If someone orders a plant online I want to make sure that their new green friend gets the best care possible, so I want to send out a care guide for that plant. Different types of plants require different types of care, so I need to send different instructions depending on the type of plant that someone has bought. We can use a lookup table to match the type of plant to a link to the correct guide.

fdd3c3c51cbee827d492cbe36220b6a4.png
 

Here’s an example of what that lookup table would look like in the Zap editor:

ebbd7db4b79aef54c3c3b2826d88c45c.png

The Lookup Key is the type of plant from the order. On the left-hand side of the table, there are types of plants and on the right is a link to the relevant care guide for that plant.

With the table set up this way, the customer will always get the right care guide for the plant they bought.

Summary

Lookup tables allow you to match the input from a previous step to a different output depending on what it is. You can build a lookup table using Formatter by Zapier, and use the output of that step in the following Zap action/s.

Things to know

A limitation of using a Lookup table is that it only works if you want to use conditional logic to change a field in a Zap action. If you need to have a different set of actions depending on your condition, the Lookup table isn’t for you. 

Another thing to bear in mind is that you need a Formatter step for each field that you need the logic for. If you need to change a lot of data based on certain conditions, another option may be better for you.

Finally, the input has to be an exact match to what's in the lookup table. If your table says "Cactus" the incoming text can't be something like "Small Cactus". It won't match.

 

Tip: If you need to keep updating the table (e.g. if you need to add new staff members to it), you can create a lookup table using Zapier Tables or Google Sheets. You can add information to the table using a Create or update row action and when you need to get then information from the table you can use a Find Row step.

 

Using multiple Zaps with a filter step

If you need different steps in your Zap based on a specific condition, one way to achieve that is by using different Zaps with a filter step.

The idea behind this approach is that you have 2 (or more) Zaps with the same trigger. A filter step in the Zap looks at the incoming data, and either stops the Zap or allows it to continue. You set up Zap 1 so that it continues for condition A and Zap 2 so that it continues for condition B.

Back at Ferntastic Finds, if a customer places an order to be delivered, then a shipping label needs to be created. If it’s being collected, then I need to email the customer to ask them when they will collect the plant. For this I need two Zaps:

  1. A Zap with a filter that only allows the Zap to continue if the order is for delivery, and has actions to generate a shipping label and send an email to the customer

  2. A Zap with a filter that only allows the Zap to continue if the order is for collection, and has an action to send the customer an email

 

ebd47bcb163ea131729abb4a1711f019.png

You can find a step-by-step guide to this approach in the help doc: Add branching logic to Zaps with filters

Summary

Using filters with multiple Zaps allows you to set up simple if/then logic. They work best when you need 2 or 3 outcomes. They’re helpful if:

  • You need different steps in your Zap depending on the condition/logic

  • Your Zapier plan doesn’t include Paths (Pro plan and above)

Things to know

You need to create a new Zap for each condition, which gets tricky if you have many possible outcomes.

Using Paths to create branching logic

Paths is a Zapier feature that’s available to users that have a Pro, Team or Company plan. It’s a powerful tool when you need to create multiple different outcomes depending on the information in your Zap. You can learn more about how Paths work in this help doc: Adding branching logic to Zaps using Paths.

Let’s take a look at how Ferntastic Finds could use paths. The store wants to offer an additional delivery option, so they now have pick-up from store, standard delivery and express delivery. For standard deliveries, the team go through the orders throughout the day as they have time. For express delivery, the team need to know as soon as it comes in so they can prioritize it. Using Paths, we can create a different path with different actions depending on the delivery option.

 

da8edeb77d95f499a05d32ddaf2ad8db.png

 

You can also ‘nest’ paths within paths. At Ferntastic Finds, I could offer gift wrapping when people collect them. Under the ‘Collection’ path, I can nest another set of paths, one path for gift wrapping and one for without.

Summary

Paths allow you to create multiple conditions within one Zap. You can ‘nest’ additional branches of logic within paths, allowing you to create complex logic rules. 

Things to know

When you’re building a Zap, you can’t add a path in the middle of it, but you can add it at the end of the Zap and move existing steps into the paths.

Recap

Lookup tables, Filters and Paths are the three most common ways to add conditional logic to Zaps. Here’s a quick cheat sheet to understanding which is right for your Zaps:

  • Lookup tables - good if you need to change a single field in a Zap based on the conditions

  • Zaps with filters - good if you need different actions for different conditions and you only have 2-3 conditions

  • Paths - good for creating complex logic trees

You can also combine them to make powerful workflows, for example putting a lookup table into a Zap with Paths.

No matter your conditions, your if/then statements, your ‘only when’ workflows, Zapier has you covered!


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +8

Love this, @Danvers! Such great visuals to help us visual learners too! 🌿

It would be great if someone could fix the pictures.

Userlevel 7
Badge +11

Welcome to the Community, @LMDev

Sorry about the broken links on the pictures. We’ve managed to locate the missing pictures and have updated the article.

Hope that helps! 🙂