I have the simple Javascript below which fetches a list of records from an Airtable view and it works just fine on my local environment. It also works fine when I am testing the Zap to fetch records.
When I manually trigger this script however it shows the following message and says it couldn’t find any new items.
What I’m trying to do
1. In airtable I have a “flag” and all records show up in a custom view
2. All the flagged records are synchronized with another platform
3. The flag is cleared in airtable and removed from the view.
Thank you!
var settings = {
'method': 'GET',
'headers': {
"Authorization": "Bearer XXXXXX",
},
};
fetch('https://api.airtable.com/v0/XXXXXXXXXX/BASE/?view=VIEWNAME', settings)
.then(function(res) {
return res.text();
})
.then(function(body) {
body.toString();
console.log();
var jsonData = JSON.parse(body);
var output = ];
for (let i = 0; i < jsonData.records.length; i++)
{
if(jsonData.recordsri])
output.push(jsonData.recordsi]);
}
callback(null, output);
})
.catch(callback);