Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

TypeError: Cannot read properties of undefined (reading 'getCellValue')

97 1
cancel
Showing results for 
Search instead for 
Did you mean: 

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!

 

 

1 Reply 1

Hm, the fact that it was working before but suddenly stopped working really makes it feel like a data issue, but as you've shown in the screenshot that field isn't empty and so this error shouldn't be appearing

Any chance you could duplicate the base, clear out any private data and share access to it so I could take a crack at debugging?