Skip to content

Instantly share code, notes, and snippets.

@on2air
on2air / create_update_airtable_script
Created May 26, 2021 23:43
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 )