Hey folks,
I’m working on a scripting action step for an Automation. It feels like querying the whole table just to search through the records is inefficient. I’m a frequent user of the Airtable API and am very used to simply asking for the record object by its ID.
Can I make this simpler?
I’m literally only trying to retrieve the field values of records that are linked to the record which triggered the automation. The Automation builder UI doesn’t allow for “looking up” fields from linked records.
// Get collaborator email from Client record.
let clients_table = base.getTable("Clients");
let queryResult = await clients_table.selectRecordsAsync(); // get all records in Clients table
let client_record = queryResult.getRecord(`${inputConfig.client_id}`) // find the one with the client_id from input
output.set("am", client_record.getCellValue("Account Manager").email)
// Get Site record linked to the Project record
let projects_table = base.getTable("Projects");
let projectQueryResult = await projects_table.selectRecordsAsync(); // get all records in the Projects table
let project_record = projectQueryResult.getRecord(`${inputConfig.project_id}`)
let linked_sites = project_record.getCellValue("Sites") // array of all linked sites