I need help with a Zapier workflow where I’m using JavaScript to generate date ranges for Airtable record creation.
I have a script that takes two input dates and should create separate database entries for each date in between. According to Zapier docs, returning an object array should trigger multiple step executions, but I’m only getting one record with all dates combined.
Here’s what I’m working with:
var startDate = new Date(inputData.start);
var endDate = new Date(inputData.end);
var results = [];
var counter = 1;
do {
var currentDate = new String(startDate.toISOString());
results.push(currentDate);
console.log(startDate);
startDate.setDate(startDate.getDate() + 1);
counter++;
}
while (startDate <= endDate);
console.log(results);
return {results};
The next step recognizes my results variable but treats it as a single value instead of processing each date separately. What’s the right way to format the return statement so Zapier creates individual Airtable records for each date?