Help

Can't create records: Could not find a choice with that ID or name

Topic Labels: Scripting extentions
Solved
Jump to Solution
4860 10
cancel
Showing results for 
Search instead for 
Did you mean: 
abderrahim_dib
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello,
I use this script for move record from table 1 to table 2, All data is moved except data of type dropdown list (Ville). I show this error: Can’t create records: invalid cell value for field ‘Ville’.
Could not find a choice with that ID or name

let table1 = base.getTable("DATA");
let table2 = base.getTable("Con");
let result = await table1.selectRecordsAsync();
for (let record of result.records) {
    if (record.getCellValue("Prét")) {
        await table2.createRecordsAsync([
            {
                fields: {
                    'ID': record.getCellValue("ID"),
                    'Source': record.getCellValue("Source"),
                    'Agent': record.getCellValue("Agent"),
                    'Nom complet': record.getCellValue("Nom complet"),
                    'Téléphone': record.getCellValue("Téléphone"),
                    'Ville': record.getCellValue("Ville"),
                    'Prét': record.getCellValue("Prét")
                },
            }
        ]);
        await table1.deleteRecordAsync(record.id);        
    }
}
[details="Summary"]
This text will be hidden
10 Replies 10

It worked :white_check_mark:
Thank you so much Heart