Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Airtable script to perform either an update or create depending on a match found
const {id,name} = input.config()
//get table from base
const tblPipeline = base.getTable("📚 Content pipeline")
//get records from table
const pipelineRecordsQuery = await tblPipeline.selectRecordsAsync()
const pipelineRecords = pipelineRecordsQuery.records
//find matching record based on matching id from input and source_id in table
let match = pipelineRecords.find( record => record.getCellValueAsString("Source ID") === id )
//if match, perform update
await tblPipeline.updateRecordAsync(, {
"Name" : name
await tblPipeline.createRecordAsync( {
Name: name,
"Source ID": id
//if no match, then create new record using name and id as the source_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment