Skip to main content

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);

Hi @dan-ap!

I’ve marked Tim’s answer above as a solution. If by chance you’re not able to get things working by following his guidance, please let us know!


Hi @dan-ap ! 

Can you let me know if this Code is running in a Trigger or an Action? If it’s running as a Trigger, what’s likely happening is that when the Zap turns on, it will look at the view and add all the records to the Zap’s deduplication table, which means the Zap has “Seen” these records and won’t Trigger on them again.

When the Zap runs, it will see the same record IDs and not Trigger because it’s seen them before.

If this is the case, the way to solve it is to use a different Trigger. When I set up “sync” Zaps like this, I typically use Schedule by Zapier to Trigger the Zap once per hour, day, or week. When the code runs in an Action, there is no deduplication to stop it from working. 

I have an example of how I run Zaps that may be similar to what you’re trying to do in detail here: https://community.zapier.com/tips-and-inspiration-5/check-spreadsheet-records-on-a-schedule-2587

Let me know if you have any other questions about this!


Hi @dan-ap! The ‘manual’ run for Zaps can be a little tricky as it depends on how the trigger app works, and the type of trigger. I’d recommend turning the Zap on and then making a change the relevant change in Airtable. If that triggers the Zap then you’re good to go!

 

If it doesn’t then you may need to reach out to the Support Team so that they can dig into your Zap with you, you can do that using the Get Help form. One thing to bear in mind is that the Support Team can’t help you with the specifics of the webhook, but they can take a look at our logs to see if it was sent and what message we may or may not have received from  Airtable in response, which should help you to debug things on your end.