You could probably do that with a custom JavaScript, but I don’t know scripting so I would handle that with Make’s automations for Airtable.
In Make’s “search records” module for Airtable, you can specify your search to sort your records in a certain order and to limit the search results to a certain number.
So you could limit your search result to only the single oldest record, and then delete it.
If you’ve never used Make before, I’ve assembled a bunch of Make training resources in this thread.
For example, here is how you would instantly trigger a Make automation from Airtable.
p.s. If you’d like to hire an expert Airtable consultant to help you with anything Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld
You can try doing this by:
1. Link all your records to a single record in another table called "Rollup" or something
2. In "Rollup", create a "Count" field to output how many linked records there are,
3. In "Rollup", create a rollup field with "MIN()" to display the earliest "Created time" value
4. In your main data table, create a lookup field to display the value from the field from step 3
5. In your main data table, create a formula field to check the value of the field from step 4 against that record's created time
6. Create an automation that will trigger whenever the "Count" field from step 2 outputs > 500, and its action will be to find the record where the field from step 5 is "True", that is to say, that's the earliest record, and then delete it with a run a script action. (There are a lot of examples of a run a script action to delete a record in the forums, but
let me know if you can't find any)
Should work!
Deleting records automatically requires the "Run a Script" action I'm afraid, so you'd need a paid account. If you don't have a paid account you can just use a checkbox to mark it as deleted and then delete all marked checkboxes once a month or something?