Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Get record by cell value

Topic Labels: Scripting extentions
1784 5
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

5 Replies 5

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 :slightly_smiling_face:

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.

Thanks again, found it here: Airtable Scripting

I have same question, my table has few thousand records and records keep growing on daily basis. I fetch new records on daily basis from server, if records are updated on server, I have to update those records in airtable else add the new records to the table. If the solution is to get all the few thousand records from the table  based on external id, iterate through them and compare the cell value, and update the record, will it not slow  down the operation? Is there any other optimized way to achieve the same?