Sometimes the script editor has trouble parsing input variables.
Have you tried running the script anyway?
Have you tried closing the script editor and reopening it?
Are you sure that the field has a value for the triggering record?
Try changing the line to this:
console.log(`The value of schoolName`, $school);
Then you can expand $school in the console to see what values are there.
A closer look at the screen shot shows that the schooName input variable is being set. The output on the right panel shows that the value is Astra College. It's just the linter in the script editor that is getting confused.

By the way, it looks like your script currently does not change any record data and does not output any data for future automation steps. Do you have plans on how to change the record data? Are you personally interested in learning scripting, or do you just want a working solution?
A closer look at the screen shot shows that the schooName input variable is being set. The output on the right panel shows that the value is Astra College. It's just the linter in the script editor that is getting confused.

By the way, it looks like your script currently does not change any record data and does not output any data for future automation steps. Do you have plans on how to change the record data? Are you personally interested in learning scripting, or do you just want a working solution?
Thank you both for your response! yep so I have closed Airtable and this morning on re opening everything is working fine without any error -- a bit odd but I'll go with it
It was working yesterday but the error made me think while it was working there was still a problem with the code which needed to be fixed.
and yes! I am very interested in learning scripting/coding, so keen to let this opportunity be one that I can learn from. It doesn't transform the data, I don't actually need it to do that -- all I want it to do is to select the records and sort them chronologically according to their start date.
What I am curious about now is how to output those entries as an array or some kind of table that I can then send in an email in a future step...? if that makes sense
Ok now I can get it to work and output an array of the found records. Later in the automation I want it to send an email with those records, however, it only works for the first one that was used as test data in the script? the repeating group doesn't appear to be iterating through the list that was selected earlier in a find records
So the first email with 'Astra College' shows their records but then the next emails show blank records...
do I need to somehow clear the script so that it gets the next variable for input.config()? or something like that?
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", "Start Date"],
sorts: [
// sort by "Start Date" in ascending order
{field: "Start Date"},
]
});
let upcomingSchedule = [];
let filteredResults = queryResult.records.filter(record => (record.getCellValueAsString("School") == `${school.schoolName}`));
// print ID & "Name" from each record:
for (let record of filteredResults) {
console.log(`**${record.id}**
${record.getCellValueAsString("Name")}`);
upcomingSchedule.push ({
fields: {
"Date": `${record.getCellValueAsString("Start Date")}`,
"Name": `${record.getCellValueAsString("Name")}`,
}
})
}
output.set(`${school.schoolName}`, upcomingSchedule);