Skip to main content

I’ve been trying to modify a script I’ve found on the airtable community that would allow me to click a button and trigger a script to move a record to another table. But it seems that in the process, it moves every record in the table. Is there a way to make it only move ONE record?


let table1 = base.getTable(“New Leads”);

let table2 = base.getTable(“Following-Up With”);

let result = await table1.selectRecordsAsync();

for (let record of result.records) {

if (record.getCellValue(“Move To Following-Up”)) {

await table2.createRecordsAsync(a

{

fields: {

‘Name’: record.getCellValue(“Name”),

‘Email’:record.getCellValue(“Email”),

‘Phone’:record.getCellValue(‘Phone’),

},

}

]);

await table1.deleteRecordAsync(record.id);

}

}


This is the script I have currently, any help is appreciated

Hi,


you are on a right way

that will help you

input.recordAsync


you should change a few lines and remove loop from code


Welcome to the Airtable community!



It looks like it moves every record that has a value in the “Move To Following-Up” field. Was this your change to the script or did it already exist in the script?


Hi,


you are on a right way

that will help you

input.recordAsync


you should change a few lines and remove loop from code


I can look into it


I have no coding nor scripting experience lol, just found this script on the forum and tried modifying it


Welcome to the Airtable community!



It looks like it moves every record that has a value in the “Move To Following-Up” field. Was this your change to the script or did it already exist in the script?


It already existed in the script before


I have no experience with scripts and coding so I just played around and reverse engineered a few things. But obviously couldn’t get those to work lol


Reply