Hi folks! Clint here again with another Workflow Wednesday! This time we’re going to talk about using Paths in Loops to tackle a complex problem.
The Challenge
I talked to someone recently who needed to do the following:
- Loop through a series of line items and add them to a Digest if they met certain criteria
- Release that digest on the very last iteration of the Loop
If we were doing either of these on their own, a Filter would be enough. But since we need to do both, then we’ll need to use Paths.
The Solution
Using a Path in a Loop is exactly the same as using Paths outside of a Loop - but it’s important to understand how Paths work in the first place.
Using Paths is basically like having multiple filters in a single Zap. Every time a Zap with Paths runs, every Path will be evaluated and run if the criteria is met. So let’s say you have two paths:
- Path A: Only continue if Email Address Exists
- Path B: Only continue if Full Name Exists
If the Zap triggers and has both an Email Address and a Full Name, then Path A and Path B will both run - it’s not an either/or situation.
For Loops, the same is true, but for each loop iteration. So if you nested Paths in a Loop like the above, then each loop iteration will evaluate both paths, and potentially run both of them simultaneously.
In our scenario, where we’re adding info to a digest and releasing that on the last iteration, the Paths will look something like this:
- Path A: Only continue if Email Address Exists - we don’t want to add any contacts with blank emails to the digest
- Action: Append Entry and Schedule Digest - we’ll add the contact to the digest since their email exists. Set the Frequency to Manual, since we’ll be releasing it in Path B
- Path B: Only continue if Loop Iteration is Last is true - this will only continue on the very last loop
- Action: Delay for 1 minute - we want to wait just to make sure all of the other loops are finished
- Action: Release Digest - we’ll release the digest from before after all the other loops have added their data
Each time the Loop runs, both paths will be evaluated. This could result in one, both, or neither of the paths running depending on what’s happening in that loop.
NOTE: You cannot have more than one Loop in a single Zap! In other words, you can’t put multiple Looping by Zapier steps into a single Zap, even if they’re in different Paths. That’s a limitation of our system - you can only put Paths into a Loop as described above.
Wrapping Up
There’s a lot of potential here to use Paths in Loops to accomplish complicated workflows. I hope this is useful to you, and let me know if you come up with any interesting ideas using this!