Help

Moving records from one table to another with checkbox (including those with formulas, date picker, single-select options etc))

Topic Labels: Scripting extentions
657 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Lynette_Nduta
4 - Data Explorer
4 - Data Explorer

Does anyone know how to include a script that includes moving records with formulas and drop-down options to another record from this, I’m stuck and it keeps giving me this error message:
ERROR
P: Can’t create records: invalid cell value for field ‘Answer Option Type’.
Could not find a choice with that ID or name
at main on line 6

This is the script:
let table1 = base.getTable(“Table1”);

let table2 = base.getTable(“Table2”);

let result = await table1.selectRecordsAsync();

for (let record of result.records) {

if (record.getCellValue("Move to Table2")) {

    await table2.createRecordsAsync([

        {

            fields: {

                'Question Text': record.getCellValue("Question Text"), 

                'Sector': record.getCellValue("Sector"),

                'Logic - Parent Question' : record.getCellValue("Logic - Parent Question"),

                'Answer Option Type': record.getCellValue("Answer Option Type"), 

            },

        

        }

    ]);

    await table1.deleteRecordAsync(record.id);        

}

}

0 Replies 0