Scripting App Vs. "Run a Script" Automation

Hello All,

I have the following script that I use to create links between tables based on the “ID,” which is consistent between the two tables. Typically, I run this script manually every few days or so, but I have recently discovered the “Run a Script” automation, which would completely eliminate the need for manually clicking the “Run Script” button. However, the following script throws an error every time I test the automation (which is when a new record in the “Enrollment” table is created, the script is supposed to run). I’ve gathered that this is an issue with certain functions not being recognized in the automation, however I do not know how to fix this. Any help would be greatly appreciated!

//Define the Facilities table and query
var facTbl = base.getTable(“Facilities”);
var facQuery = await facTbl.selectRecordsAsync();

//Define Enrollment table and query
var conTbl = base.getTable(“Enrollment”);
var conQuery = await conTbl.selectRecordsAsync();

// Create an updates array
let updates = ;

//Loop through the records of Facilities
for (let facRecord of facQuery.records) {
let FacTpID = facRecord.getCellValue(“ID”);
let Sources = ;
//Loop through the records of Results table
for (let resRecord of conQuery.records) {
if (resRecord.getCellValue(“ID”) === FacTpID) {
Sources = […Sources,{id:}]
// Push update into the updates array
fields: {
‘Enrollment’: […Sources]
// Update records
while (updates.length > 0) {
await facTbl.updateRecordsAsync(updates.slice(0, 50));
updates = updates.slice(50)}

Scripts are having issues right now. I suggest you wait until Airtable status is back to normal before resuming your development.

1 Like

Hi kuovonne,

Thanks for your reply! I saw that the Airtable team just fixed the scripts issue and the automation is now running perfectly. Thank you for your reply!

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.