I am going crazy trying to narrow down this error. I'm trying to automate payment creation based a date, number of payments, amount, and a linked record. I will eventually layer in frequency as well. Below is the code that I currently have but I keep getting ReferenceError: table is not defined at main on line 12.
let settlementPaymentsTable = base.getTable("Settlement Payments");
let config = input.config();
let numRecords = config.numRecords;
let dueDate = config.dueDate;
let paymentAmount = config.paymentAmount;
let matter = config.matter;
// Function to create a new record
function createRecord(settlementPaymentsTable, dueDate, amount, matter) {
// Create a new record with the due date, payment amount, and matter ID
let record = settlementPaymentsTable.createRecordAsync({
'Due Date': dueDate,
'Payment Amount': amount,
'Matter ID': [matter]
});
}
let i = 1;
while (i <= numRecords) {
// Create a new record with the due date, payment amount, and matter ID
createRecord(settlementPaymentsTable, dueDate, paymentAmount, config.matter);
// Increment i
i++;
}