Get record by cell value

Is there any way to get a record by a cell value?

I have an API hitting a webhook and passing in an external ID, which is present in the table as a value in the “External ID” cell. I need to get the associated Record.

Seems the only solution is to iterate over the entire table until I find the assocaited record using

if( record.getCellValue("External ID") == input.externalId ) { ... }

Would love to know if there is a better way.

This is what you must do in Scripting app. It is actually fairly fast, especially if you limit the number of fields returned when you initially select the records.

If you need to retrieve a lot of data for that particular record, and requesting all of those fields slows down your script too much or requires too much memory, you can use a two phased approach. In your initial request, ask for only the field you need to match on. Then filter for the record and get its record id. Finally issue a second selectRecordAsync call (note the singular) and pass in the record id that you just obtained.

Finally, there are complex methods involving storing a hash of keys to record ids. These systems are fairly complex to maintain and require multiple steps as well.

Thank you. It’s not a large table… just had me wondering if I was missing something.

Now onto figuring out how to SET a value of a linked table cell from the script :slight_smile:

Nope. Not missing anything.

As far as setting the value of a linked record field, look in the documentation for the write format. The documentation is quite good.

1 Like

Thanks again, found it here: Airtable Scripting

1 Like