Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

Example Script for Automations Mark Duplicates

Topic Labels: Automations
Jump to Solution
532 6
Showing results for 
Search instead for 
Did you mean: 

I’m trying to us the example script, and keep getting:
airtable recordid should be a string, not undefined
I am using the script as is, except I changed the table name on line 2.
I followed instructions on how to configure input variables using the left panel.
I added recordID field to my table, using the recordID function in formula field. When that didn’t work, I changed to a short text field, preserving the generated record ID values, but I still got this error. I’m out of ideas. Can someone help?

“TypeError: Invalid arguments passed to recordQueryResult.getRecord(recordId):
• recordId should be a string, not undefined”


1 Solution

Accepted Solutions

Make sure the capitalization of the input variable matches what you’ve typed in the script, and try pulling the record ID directly and not from a calculated field value

See Solution in Thread

6 Replies 6

Do you actually have a variable in your script called recordId? I can’t really help diagnose what’s wrong without actually seeing the script in question.

Thank you!
I am using the example script - the only thing I changed in the table name in line 2. I made some changes to my table to add and rename the fields, with the names used in the script “Duplicate to” and “recordID”. Here is the code:

// the table to check

let table = base.getTable(“Form View Table”);

// the record we’re searching for duplicates of.

// we need to create a ‘recordId’ input variable connected to a record trigger

let config = input.config();

let recordId = config.recordId;

// the field to save duplicates in. this should be a self-linked record field

let duplicatesField = table.getField(“Duplicate of”);

// query the table and find our record according to its id:

let query = await table.selectRecordsAsync();

let record = query.getRecord(recordId);

// search for duplicates

let foundDuplicates = query.records.filter((potentialDuplicate) => {

// if they're the exact same record, they're not duplicates:

if (potentialDuplicate === record) {

    return false;


if ( === {

    // if the names match, we've found a duplicate:

    return true;


return false;


console.log(Found ${foundDuplicates.length} duplicates of ${});

// save the duplicates:

await table.updateRecordAsync(record, {

[]: foundDuplicates,


Did you set up your input config variable for recordId? You configure inputs to the left of the script editor.

Yes, I did configure the inputs on the left side. RecordID.


Sharon Gay Phelps, Realtor®
Howard Hanna Real Estate Services

What’s Your Home Worth?

Get up to three automated Estimates - Instantly.
No cost, and no obligation.

My Reviews – Read them, Write one, Thank you!

Nothing contained in this email shall be deemed to constitute or form the basis of an offer, acceptance, counteroffer, contract, agreement or other binding obligation until and only if also delivered and executed in writing between appropriate parties.

Make sure the capitalization of the input variable matches what you’ve typed in the script, and try pulling the record ID directly and not from a calculated field value

Thank you. There was a discrepancy with the capitalization. Now it works.