
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 08, 2022 06:07 PM
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([
{
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 09, 2022 04:46 AM
Hi,
you are on a right way
that will help you
input.recordAsync
you should change a few lines and remove loop from code

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 09, 2022 04:58 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 09, 2022 06:00 AM
I can look into it
I have no coding nor scripting experience lol, just found this script on the forum and tried modifying it

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 09, 2022 06:01 AM
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
