Hi all!
I'm very new to scripting and I have this code that was working before until recently. When I run the code I see
TypeError: Cannot read properties of undefined (reading 'getCellValue')
at main on line 271
Line 271 is
let client_apps = globals.site.getCellValue("Apps")
For reference this is the first part of the code that the line is referencing:
var globals = {}
let client = await input.recordAsync("Which client has a change?", base.getTable("📊 Clients"));
const sitesTable = base.getTable("🌐 Sites");
const sitesQuery = await sitesTable.selectRecordsAsync({fields: ["Apps", "Client", "Site Name", "Site Type", "Status"]});
// Does the client have multiple OTT sites? If so, we'll need to know
// which app suite the change applies to
// Get all the client's Site records
var clientSites = sitesQuery.records.filter(record => record.getCellValue("Client") && (record.getCellValue("Client")[0].id === client.id));
// Only proceed with the OTT sites
var clientSites = clientSites.filter(record => record.getCellValueAsString("Site Type").includes("OTT") && record.getCellValueAsString("Status") == "ON");
if (clientSites.length > 1) {
globals.site = await input.recordAsync("This client has more than 1 OTT site. Which site's apps need a change?", clientSites)
} else {
globals.site = clientSites[0]
}
When I run the code I get all the way past choosing a specific record from the "sites" table but when I get to the "getCellValues" it's showing that TypeError.
I can confirm that cell isn't empty and should have the records linked to that cell as per the ss I attached.
Any help at all would be appreciated!