Help

Re: Fastest way to retrieve a specific record by ID

Solved
Jump to Solution
2702 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Matt_Caruso
6 - Interface Innovator
6 - Interface Innovator

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
1 Solution

Accepted Solutions
Justin_Barrett
18 - Pluto
18 - Pluto

Not currently. I agree that getting a list of all records before you can ask for a specific record feels like a roundabout approach, but it’s the only approach available at the moment. Here’s hoping that we can eventually call getRecord directly on a table or view instance!

See Solution in Thread

2 Replies 2
Justin_Barrett
18 - Pluto
18 - Pluto

Not currently. I agree that getting a list of all records before you can ask for a specific record feels like a roundabout approach, but it’s the only approach available at the moment. Here’s hoping that we can eventually call getRecord directly on a table or view instance!

Well, I’m at least glad I wasn’t missing something obvious. Thank you!