I want to check if a customer already exists in my database by searching for their email address. If the email is not found, I need to create a new customer record.
This gives me a different error saying select only accepts one parameter and I should use eachPage or firstPage methods instead. What am I doing wrong with the formula syntax?
Your filterByFormula syntax is incorrect. In Airtable, the FIND function does not work the way you are using it. For exact matches, use {Email} = '${emailAddress}'. Alternatively, if you’re looking for substring matches, you could use FIND('${emailAddress}', {Email}). I recommend using the select method along with firstPage for better results, such as database('customers').select({filterByFormula: {Email} = ‘${emailAddress}’}).firstPage((err, records) => { ... }). Additionally, ensure that your field name matches exactly as it appears in your Airtable base, as Airtable is case-sensitive.
Two key fixes: use double quotes in the formula instead of single quotes (way more reliable), and switch from replace to update since you’re modifying an existing record, not replacing the whole table.
Also double-check your Airtable field is actually named “emailAddress” and not “Email” or something else.
You’re mixing up API methods and using the wrong approach. find gets a single record by record ID - it doesn’t search by field values. Since you want to search by email, use select with firstPage:
Double-check that your field name in the formula matches exactly what’s in Airtable. You need those curly braces around the field name or the formula won’t work.