Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Table is not defined error using form fill as input for Airtable Script

Topic Labels: Automations
649 0
cancel
Showing results for 
Search instead for 
Did you mean: 
ScriptN00b
4 - Data Explorer
4 - Data Explorer

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++;
}

 

 

0 Replies 0