I am trying to hava a base or table that keeps track of all of the visible fields in a view, and I want this to be done automatically whenever a fields is added, removed or it's visibility is changing. We have more than 30 views and more than 30 fields. I am getting this error, whenever I try to run the following code.
let table = base.getTable("Master Product List");
console.log(table)
let recordId = input.config().triggerId;
let records = await table.selectRecordsAsync();
//let updatedRecord = base.getTable('Master Product List')
let updatedRecord = records.getRecord(recordId);
console.log(updatedRecord)
let viewNames = [];
let views = await table.views;
console.log(views);
for (let view of views) {
let queryResult = await view.selectRecordsAsync();
let recordIds = queryResult.recordIds;
if (recordIds.includes(updatedRecord.id)) {
viewNames.push(view.name);
}
}
let newFields = {
Views: viewNames.join(", "),
};
await table.updateRecordAsync(updatedRecord, newFields);
console.log(viewNames)
//end of code.
Is there a better way to accomplish this that does encounter this limitation, and preferably does not rely on api calls or some third party solution?