Table of Contents
When you find yourself repeating the same task over and over again in Airtable, you can use Automations in Airtable to save time. Automations in Airtable, however, have limitations. A glaring one, being able to iterate through a list of records in automations.
Instead on moving the Automation to another tool (Zapier / Integromat), use Airtable Scripts.
With Airtable's scripting you can do so much!
Use Run Script as an action in Automations
Copy a list of records from one table to another
Here's a simple script to copy from table Source to Destination
let inputConfig = input.config();
//define the table to copy records from
let sourceT = base.getTable('Source');
//get the records from the table above
let sourceQ = await sourceT.selectRecordsAsync();
//filter the records above
let filteredItems = sourceQ.records.filter( items => {
return items.getCellValueAsString("Status").includes("Registraion")})
let finalItemsList = [];
//iterate through the list of records
for (let item of filteredItems) {
//create the new list of records
finalItemsList.push(
{
fields: {
'Status': inputConfig.recordID,
'Name': item.name
}
}
)
}
//add to the destination table
let finalItemsT = base.getTable("Destination");
finalItemsT.createRecordsAsync(finalItemsList);
Use Cases for Automation through Scripts
You can use this for iterating through Tasks in a Project, Line Items in an Invoice, Order Items in an Order and more.
Airtable can be an amazing tool for automating processes that would take you hours or days to complete manually. If your automation is missing some steps, just use scripts.