Hey everyone, I’m working on an Airtable script that’s giving me a headache. I want to make multiple records based on what users put in a form. The form asks for stuff like how many payments, when the first one is due, how often they happen (let’s say monthly for now), and how much each payment is.
Here’s what I’ve got so far, but it’s not working:
// Get user inputs
let paymentCount = input.numberAsync('Payment Count');
let startDate = input.dateAsync('First Payment Date');
let amount = input.numberAsync('Payment Amount');
// Create records
for (let i = 1; i <= paymentCount; i++) {
makeNewEntry(i, startDate, amount);
}
function makeNewEntry(num, date, cash) {
// Logic to create record goes here
console.log(`Created payment ${num} for ${cash} on ${date}`);
}
The problem is, I’m getting an error saying ‘Property ‘numberAsync’ doesn’t exist’ for all my inputs. Any ideas what I’m doing wrong? Thanks in advance for any help!
hey grace, i had a similar issue. the problem is ur using ‘numberAsync’ which isn’t a thing in airtable scripts. try using input.config() instead to set up ur inputs. somethin like:
Hey Grace, I’ve dealt with similar Airtable scripting challenges before. Your approach is on the right track, but there’s a small tweak needed to make it work.
The issue lies in how you’re trying to get input values. Airtable scripts use a different method for handling inputs. Instead of methods like ‘numberAsync’, you need to use input.config() to set up and retrieve your inputs.
Here’s a quick modification to your script that should resolve the error:
let paymentCount = input.config({
type: 'number',
name: 'Payment Count',
});
let startDate = input.config({
type: 'date',
name: 'First Payment Date',
});
let amount = input.config({
type: 'number',
name: 'Payment Amount',
});
for (let i = 1; i <= paymentCount; i++) {
let paymentDate = new Date(startDate);
paymentDate.setMonth(paymentDate.getMonth() + i - 1);
// Your record creation logic here
console.log(`Payment ${i}: ${amount} due on ${paymentDate}`);
}
This should get you past the error and onto creating those multiple entries. Remember to add some error handling and adjust the date calculation as needed for your specific use case. Good luck with your project!
I’ve run into this issue before. The problem is with how you’re trying to get input values. Airtable scripts don’t use methods like ‘numberAsync’ or ‘dateAsync’.
Instead, you need to use input.config() to set up and retrieve your inputs. Here’s a quick example of how you could modify your script:
let paymentCount = input.config({
type: 'number',
name: 'Payment Count',
});
let startDate = input.config({
type: 'date',
name: 'First Payment Date',
});
let amount = input.config({
type: 'number',
name: 'Payment Amount',
});
for (let i = 1; i <= paymentCount; i++) {
let paymentDate = new Date(startDate);
paymentDate.setMonth(paymentDate.getMonth() + i - 1);
// Create your record here using the calculated paymentDate
console.log(`Payment ${i}: ${amount} due on ${paymentDate}`);
}
This should resolve your error and get you on the right track. Remember to add error handling and adjust the date calculation as needed for your specific use case.