Blog
How to run a script for an array of records in Airtable Scripts

How to run a script for an array of records in Airtable Scripts

Smiling man wearing a cap and gray t-shirt sitting in a home office environment with a yellow chair and shelves in the background.
Connor Finlayson
October 13, 2022
How to run a script for an array of records in Airtable Scripts

A very common automation use case that needs to be solved for is running workflows for many records rather than just one. Tools like Nobull from Finsweet, Parabola or Make.com are very good at allowing to do this, but did you know with only a few lines of codes you will be able to do the same in Airtable Scripts.

Importing your table

The first thing we want to do writing our script is to make sure we are importing an array of records rather than just importing a single record. We can do this using the "query.records" function after we define our base and table.

Running a script for every record in our array

Once we have successfully queried our set of records in our table or view, we will now be able to use the for function to run a script or function for each record within our array. Once we have added our script within the for function, Airtable scripts will run for through each and run the script that we specified.

After your run your script, you should see a list of properties returned

How to use the "for" function

The "for" function can be used for a lot of different things, but properly the most common use case is to bulk create or bulk update records. If for example, you have added a new fields to your Webflow CMS and you want to update all of your records with a value that sits inside of Airtable, then you will be able to do just that with the for function.

Table of contents