Table of Contents

Update Multiple Records in Airtable Using a Loop

Cesar Banchio Updated by Cesar Banchio

In case we want to update multiple records that share one condition, we can use a loop to do so. The loop will be similar to the one we created on this article, but with a few changes to it.

The flow will look like so:

Let's analyze each block. The first Airtable block gets the multiple records we want to update. We use an advanced filter on this case. On this example, we will update all records that have the column Name= "myname" and the Phone= "not changed". This last one is the field we will update to something else. The block looks like so:

And we will save the result in an array called result:

Next block we create a variable @length that will store the length of the @results array:

Length(@result)

As we will be updating the Phone column, the @result array will be getting shorter.

Next block is a conditions block that checks is @length is = 0, if so, that means all records have been updated, else, we move forwards.

Next block is a code set block. This will remove an element from the array and save the result in the @result array. The snippet is the following:

let res = @result;

res.shift();

return res;

The next block is optional, is just displaying the @result array as a message.

The next block will be the one in charge of updating the record. It's an Airtable block which the following structure:

So we are updating a record, and we are using the same advanced filter we used to get the multiple records on the first Airtable block. And in the update section, we will update the value of Phone to changed:

It's crucial that you update a record that is being used in the filters!

This block will be connected to the formula's block. When we come out of the loop, all records should have be updated.

How did we do?

Airtable usecase: Create an event registration bot with limited availability

Reservation bot with Airtable

Contact