I think @Neetzie is using Airtable.js, an SDK for the Airtable API.
I tend to avoid the SDK (old-school API hack is my thang). But, I do know that despite the SDK providing a filter method, it still must enumerate all records to find the last one and its record ID.
Given the current API, there are no methods (as far as I know) to get the last record ID without traversing all pages (collections of 100 records) and all records. Furthermore, there is presently no API method to dump a list of records constrained in a fashion to include only certain fields (which would be a very lightweight request that didn’t involve pagination).
My Approach…
If I want to get the most recent record ID in a table, I…
- Request the entire table
- Iterate across the records to construct a 2D array containing only the record IDs and created date
- Sort the array [descending] on the created date
The last known record ID will be myArray[0].recordID. I believe this is pretty much what your SDK code is attempting to do, but I can’t see enough of it to assess why it isn’t working as expected.
If there’s a more elegant (and efficient) way to do this, I would love to see one.