Script used in other tables won't work in a newly created table

Topic Labels: Scripting
656 2
Showing results for 
Search instead for 
Did you mean: 
7 - App Architect
7 - App Architect

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 = => {
  return {
    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: 


Error: No field matching "View" found in table "Udbetalingsform-tilbagemelding"
    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'?

2 Replies 2
12 - Earth
12 - Earth


const filteredRecords = records.records.filter(record => {
return record.getCellValue("View") === viewId;

getCellValue returns record value at some field, so you should put field name here.
also, it seems like your filter will return empty array, I doubt you store viewID as values in table

idk why do you use IDs instead of names, but unless you have special reason for that, it just a way to add complexity to a simple thing ))

Sometimes people use IDs instead of names so that the script will still work even if the table and field names change. 

However, I agree that using table, view, and field IDs without some other method of indicating the intended items can be confusing.

Note that this script will also have problems if there are ever more than 50 records to update (once the filtering issue is sorted out).

I also find some of the variable names slightly confusing/misleading: records, and updatedRecords.