A way to trigger a automation when a certain number of records are created?

Topic Labels: Automations
2070 5
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

Is there a way to trigger an automation when for example 1500 records are created in a specific table within a database? I have been trying to find a way but there is no solution.

5 Replies 5
10 - Mercury
10 - Mercury

Hi Carlos. It’s not something I’ve ever tried, but I can envision a couple of ways. Let’s start with the first and maybe won’t need the second.

In your automation, your trigger is on “when a record is created”. Then you will use a find records action with a condition that matches all records (like your primary field is not empty or whatever) or use a view that zero filters. Lastly, you will create a conditional action based on the length of list of records found in the prior action. Would that, or something like it, work for you?


The Find Records step searches for the first 100 records that match the conditions. I would use your general methodology, but replace the Find Records step with a Run a Script Action that queries the table and outputs the total number of records.

You can use a script like the one below:

let {recordURL} = input.config()

let urlParts = recordURL.split("/")
let tableId = urlParts.find(x => x.substring(0, 3) === "tbl")

let count = 0

if (tableId) {
    let table = base.getTable(tableId)
    let query = await table.selectRecordsAsync({fields: []})
    count = query.records.length

output.set("count", count)

^ The script above makes use of an input variable to always pull from the table in which the trigger record resides using an input variable for the record URL and extracting the table ID:

Alternatively, you could delete all lines before:

let tableId = urlParts.find(x => x.substring(0, 3) === "tbl")

and replace that line with

let tableId = "Name of  Table"

but if you ever rename your table, you’d have to go back and modify the script to reflect the new table name. The original script should require no edits even if you switch the table from which the Automation is supposed to fire from.

Welcome to the Airtable community!

In general, the triggers for Airtable automations are either based on field data, the creation of a record, or time-based. There is no trigger for the total number of records in a table.

Some options:

  • Have a time-based trigger that periodically checks for the number of records in the table, and then triggers the actual automation that you want. This will probably involve scripting.

  • Have a system that keeps track of the total number of records as a field value. This is sometimes done by linking all of the records in the table to a single control record. Then have a count field that tells you the number of linked records. You could then trigger the automation based on the value of the count. Of course, this also means that you need a mechanism for linking all records to the control record, which would be another automation. I do not recommend this method because it will slow down your base.

  • Have a system that automatically increments a number field in a control record whenever a record is created. Then trigger the real automation off this number field.

Thanks Kamille! I didn’t know that.

Thank you so much! I will try this today with the actual data, I ran an small test and it worked.