If you're building an advanced
automation that requires a loop, some sort of iterative process, that's going to repeat itself
an undisclosed number of times, look no further than this video. We're going to be diving
into this advanced feature, which is currently being
beta tested inside of Zapier. So if that's of interest stick
around and let's get into it, Welcome back to the channel. If
you're new here, my name is Gareth. I'm the owner at GAP Consulting, and I'm going to help you save up
to 20 hours or more every week, thanks to the help of no-code tools
and automation. Now, first of all, if that's an interest and you
want to learn more about this, I am going to offer to teach you the
building blocks of automation in my free webinar to sign up, visit me at Gareth pronovost.com/webinar-registration. And we'll make sure that that gets sent
immediately to your inbox so that you can watch that recording and learn
how to build automations and start leveraging the power of no code
tools. But without further ado, let's hop into the heart of the video
where I'm going to be showcasing this advanced automation
feature inside of Zapier. Now you're probably aware that we
have to start with the data structure. So let's first hop on
into my air table screen, and I will outline the problem that we're
trying to solve with this automation. And then we're going to get to actually
seeing that loop in action. So, first and foremost, from a data
architecture point of view, we are looking at our
projects and our sprints. This is assuming that we're working within
some sort of scrum methodology where we have sprints that are
assigned to a project. And we want to be able to assign a
number of sprints to a project within one automation. But that number of new
sprints that we're assigning is variable. It's not always going to be just
one sprint or just two sprints. So how do we build an automation that
includes a variable amount of sprint adage back to our project? Well, first
and foremost, we have a project name, obviously we're linking
our projects to sprints. I have here a field where I'm denoting, how many sprints I want to create with
this automation in this case, it's two, but I could plug any number in
here, make it five, for example, and then this would
create five new sprints. Then here I have a button and
this is attached to a web hook, which I'll get to in just
a moment. And over here, we've got a few formulas and roll-up
fields starting with our current sprint count. This is looking at how many sprints we
currently have connected and linked to a particular project. In this case, I
have three sprints already linked up. Now for this particular example, I don't know why I elected to use a
roll-up and I'm using the sprint value number and I'm pulling in the max value, but the more proper way to do this would
have probably been to use a count field itself. So let me go ahead
and make that change. The outcome here will not be
changed one way or another. The account field is simply
the more accurate way to
represent this data because in fact, I want to count how many
linked records I already have, how many sprints in this case
are attached to my project. So the count will give us
the same outcome here, three, then I'm looking at my next sprint. This is the next sprint I need to
create because if I have three already connected, well, it's simple
enough. I just add one here. And I know that my next sprint is
going to be sprint number four. And then I also have a formula
here. That's saying, well, I know how many I need to stop at
how many times do I need to create new sprints? And what is the max number of sprints
going to be when it's all said and done. And in this case, we have three sprints
and we know we're adding five more, so easy enough formula here.
We're calculating eight. And then I'm also pulling
in a record ID. This, of course being meta data that we can
call upon with a record underscore ID function or formula. I know
that was a lot to unpack. So if you have to go back
and rewatch, feel free, but let's move now into the
sprints. This is straight forward. I just have an ID here that
is concatenating, both my
project and sprint number. Then I'm linking to the project. Then I have my sprint counts and this
is just a number field that ticks up by one. And I'll show you how in a minute. And then of course I
have a start date here. So let's for the sake of this
example, not worry about start date. Let's just worry about putting
those sprints into action. We need to create five new sprints
starting with sprint for ending on sprint eight. We've got to get this loop
to be a variable number of sprints. Every time popping into Zapier,
I've already set up my trigger. This is using a web hook. If you're not
familiar with how to set up a web hook, trigger, check out the video
that I'll link to around here. That is really important to understand
how we're getting that button to trigger the automation when pushed. And then after that I'm using the find
function because when I push that button, I'm sending through the record ID and
then I'm going back into my air table project's table. And I'm finding,
or looking up that record ID. That's where we're going to take
off now with the loop function. So I select here to add a next
step. And if I start typing loop, we will see that Zapier now has
looping by Zapier in beta test. I'm going to select an action event and
I have three different types of loops. I can create either a loop from
text a loop from line items, or in this case, we're going to go with creating a loop
from numbers because I've already built all the numbers I require in
order to perform the logic here. When I select a numbers and continue, it's going to ask me for different
inputs, where do I want to start counting? Where am I going to end my count? How many am I iterating by every
time I tick up in this case, I'm just going to count by ones. And then what is my maximum number of
loop iterations that could ever occur putting in a number here, by the way, it's going to save you and make sure
that you don't go a little crazy and accidentally go nuts and spend a bunch
of tasks that you didn't intend to spend. So maybe I'll set this
to 10 and I'll say, look, I'm never going to push the
button. If there are more than 10, that need to be created at a time. But
what about my start and end counters? Well, let's pop on, in and put
in some variable information, some dynamic data that
came from the record. We just looked up when
we looked up that record, we know what the next
sprint number is, right? Because we know the total
count right now is three. So the next one must be four. So
we can plug that in. Similarly, we can plug in the end count because
we did that math in air table as well. We know that it's going to end on count
eight. So when we give this a test, we're going to see that
yes, we'll test and review, and it will have iterated five
different times, but more importantly, it's actually identifying that
loop iteration as four to start because that's the first
one we started with, but we also want to make sure that we got
the right number of iterations in this case five. So five new iterations
ranging from four to eight. It's exactly what we were looking
for. Now, inside of the loop, inside of the loop itself, we can go back to air table here and
we will create that sprint record inside of air table. So I just need to choose my air table
account as one does. And over here, I'm going to be asked to name my base. There's my Zapier loop base. I'm
looking for my Sprint's table. That's where I'm creating this record.
And now what do I need to tell it? Well, as I said, we're going to ignore,
start date for this example. We just want to plug in the sprint
number and the right project. So of course we know the project
and we want to use the record ID. We found that in step
two or alternatively, we could also just use the record ID
that we passed here in the web hook, because it's the same record ID. But the most important part is coming
into that sprint and including the current iteration number. So if we look
at all of our numbers here, we see our current loop iteration, the last loop iteration and the
number of total iterations. Now, of course, every time this task runs,
it's going to occur inside of the loop. So that loop iteration counter is going
to be increasing by one each time. Now, if we just test this step, we're only going to test it once
inside of the actual loop set up here. And so we see that, yes, we were able to create sprint four with
the appropriate piece of information here, but we want to actually
see it in full action. So let's make sure to name
our automation and turn it on. Once it's registered that it's on, we'll go back to our air table
database and make sure that we have a scenario here that we want to test. So I'm going to remove
my additional sprints. I see that I currently have sprint count
four because we have four created let's suppose we want to create three more
automatically table knows that. Yes, my sprint count is currently four. I need to start with sprint five
and I want to stop on sprint seven. Let's hit that button and see if
that properly creates those sprints. There they go right before eyes,
sprint five, six, and seven, getting added to the database. And it stops when it reaches
that now for a bit of a pro tip, if you want to make sure that people
on your team aren't hitting this button prematurely, you probably know that you can build
conditional logic inside of your button. In this case, I've said only if the additional
sprints are greater than zero. Do I want to do this right?
So if I remove that number, now I can't push the button.
There's nothing there. So a bonus pro tip for you
is inside of our automation. Let's make sure that we wipe out the
sprints after we create them or in this case actually, before we create
them, before we enter the loop, you see that there's no way for us to
actually add steps outside of the loop, only inside of the loop. And of course, I only want to change the project back
to zero additional sprints one time, but I can do it before I enter the
loop without breaking anything. Because in fact, the loop
is looking at step two. So let's actually plug a step here in
the middle where we go back to air table and we update that project count.
I'm going to update the record, choose my proper air table account. Of course I'll have to find my base, go back to my projects
table. And in this case, I am looking up the record
that I just identified. Again, I can use the catch hook here because
I passed through the record ID, or I could use the record ID that I
located in step two, the same thing. Right? So in either case, what I want to do is actually
wipe out the additional sprints. And if you look closely, you'll see that you can clear a cell
value by entering exactly three spaces. 1, 2, 3. There we go. Let's give this a test and
we should be good to go again. I'll just turn my automation
back on and let's make sure that yes, in fact, this works, I'm going to start testing it one
more time with project number two. Now project number two has no sprints. I
can hide all these other fields, right? I don't need them. I don't need
to know what my total count is. I don't need to know what my record ideas. All I need when I'm working on
this base is what's my project. How many sprints do I want to add
to it and give me that button. So let's create seven sprints.
I put a seven in, I hit create, it opens up my web hook. My automation
comes back and clears out my sprints. And then over here, we're
going to see that, yes, it's properly creating all of those.
I should have grouped by project. So let's do that now. And we see the project to just got
seven new sprints and we wiped it out. If I want to create two more sprints,
it'll create sprints eight and nine, as soon as the automation has run and
it clears out my additional sprint count so that I can go again and there
they are. Sprint's eight and nine, pretty cool stuff. How are you going to start using looping
inside of your automated processes? Drop me a comment below. Let me
know. And I will see you in that. The next video as always. I hope you found that to be
extremely helpful if you did. And you'd like to learn more swing by
our website and see how we can help. We offer a free air table crash course
that will help you level up in air table quickly. And we also
have some paid services, including hourly consultations
with our experts. We have some online courses
and a group coaching program. And for advanced needs, we can build a
bespoke solution for you from scratch. So swing on by, and I look forward
to connecting with you soon.