You can do this using Automations no? Use a checkmark instead -> when checked then create new record?

I'm not (yet) a scripting pro but should be able to answer this after the Learning Airtable Scripting streams in October
but using a button and script would've been so much cooler.... FINE
Here's a script you can use from a button.

// Change this name to use a different table
let table = base.getTable("Table");

// Prompt the user to pick a record 
// If this script is run from a button field, this will use the button's record instead.
let record = await input.recordAsync('Select a record to use', table);

if (record) {
    output.text(`Duplicating the record: ${record.name}`);
    const newRecord = {};
    // Filter out computed fields which cannot be duplicated
    // Then loop through each field and add the record's value to the new record
    table.fields.filter((field) => !table.getField(field.name).isComputed).forEach(({ name }) => {
        newRecord[name] = record.getCellValue(name);
    });
    // Create the new record
    await table.createRecordAsync(newRecord);
    output.text(`Record Duplicated!`);
} else {
    output.text('No record was selected');
}
doooope thanks Curtis!
You could also right click and duplicate record no? 

Post a comment

Log in