I have a Google Form that is pulling records into a table using automation. Once we’ve reached out to those people, we archive them with a checkbox. However, it’s gotten to the point where it’s hard to sort through the archived and ones we still need to contact. I’m using a script to create an automation where once the archived checkbox is checked, the record will be deleted off the existing table and moved to an “archive” table. My problem is that it’s throwing an error code for any field that has preset answers (multiple select or dropdown). I am still new to Airtable scripting so I’m struggling!
ERROR CODE:
Error: Field “Who are you interested in booking an appointment with?” cannot accept the provided value.
at main on line 6
CODE:
let table1 = base.getTable(“Referral Calls copy”);
let table2 = base.getTable(“Archive”);
let result = await table1.selectRecordsAsync();
for (let record of result.records) {
if (record.getCellValue(“Archived”)) {
await table2.createRecordsAsync([
{
fields: {
‘Name’: record.getCellValue(“Name”),
‘Archived’: record.getCellValue(“Archived”),
‘Who are you interested in booking an appointment with?’:
record.getCellValue(“Who are you interested in booking an appointment
with?”),
‘Phone Number’: record.getCellValue(“Phone Number”),
‘Call Date/Time’: record.getCellValue(“Call Date/Time”),
‘Status’: record.getCellValue(“Status”),
‘Assigned Therapist’: record.getCellValue(“Assigned Therapist”),
‘Notes’: record.getCellValue(“Notes”),
‘S reviewed’: record.getCellValue(“S reviewed”),
‘Email Address’: record.getCellValue(“Email Address”),
‘Session Day Preference’: record.getCellValue(“Session Day Preference”),
‘Session Time Preference’: record.getCellValue(“Session Time Preference”),
‘Payment Preference’: record.getCellValue(“Payment Preference”)
},
}
]);
await table1.deleteRecordAsync(record.id);
}
}