Hello!
I have practically no experience with Javascript and scripting but I am turning to the Run Script in my Airtable automation as a last resort.
In my automation I am finding a list of schools and then using a repeating group to go through each school and find values where the school is in the schedule table. I am running a script in this repeating loop to get all the entries in the schedule where the input value is from the schools. I am doing this so I can then order these according to start date which Airtable doesn't let me do.
You can see my automation in the attached screenshot.
The script is below and it works but I keep get an error on schoolName (which you can see in my other attached screenshot) telling me:
Property 'schoolName' does not exist on type '{}'.(2339)
Can anyone help? I don't really know why I am getting this error?
Thank you!
let school = input.config();
console.log(`The value of schoolName is ${school.schoolName}`);
// query for all the records in a table
let table = base.getTable(" Schedule");
let tableView = table.getView("Prep Emails Automation")
let queryResult = await tableView.selectRecordsAsync({
fields: ["Name", "Term", "School"],
sorts: [
// sort by "Start Date" in ascending order
{field: "Start Date"},
]
});
// print ID & "Name" from each record:
for (let record of queryResult.records.filter(record => (record.getCellValueAsString("School") == `${school.schoolName}`))) {
console.log(`
**${record.id}**
${record.getCellValueAsString("Name")}
`);
}


