Hello everyone!
I have this script:
const tableId = "tblapiXxSQL4FGs7G";
const table = base.getTable(tableId);
const viewId = "viwVt3r8YFoHt5sy6";
const view = table.getView(viewId);
const records = await view.selectRecordsAsync();
const filteredRecords = records.records.filter(record => {
return record.getCellValue("View") === viewId;
});
const updatedRecords = filteredRecords.map(record => {
return {
id: record.id,
fields: {
"fldOhTCFbOqx05nxk": "",
"fldDCytU41W6YcJQu": ""
}
};
});
if (updatedRecords.length > 0) {
await table.updateRecordsAsync(updatedRecords);
console.log(`Updated ${updatedRecords.length} records.`);
} else {
console.log("No records to update.");
}
The purpose with the script is to have certain fields cleared for value when x conditions are met. It works like a charm in other tables, but in my newly created table it just won't work. I have inserted the correct IDs (table, view and fields), but the error I get is this:
at <anonymous> on line 9 at main on line 8
As mentioned it's the exact same script used in other tables, and those tables does not have a field named 'View' either, so why does it suddenly want a field named 'View'?