Zapier code to run each step in the Zap for each individual record in a view or search


This loops through all the records from a view or search and performs the following steps for each record.

It is intended to run after something else triggers it.

It returns all fields of the records as well (as long as you include them in your query), so that you can use them as ingredients in the following steps of the zap without having to do a separate lookup.


Here is the code where you can copy and paste it.

var settings = {
  'method': 'GET',
  'headers': {
    "Authorization": "Bearer <API KEY HERE>",
fetch('', settings)
.then(function(res) {
  return res.text();
.then(function(body) {  // body is the raw return from the API call
    var jsonData = JSON.parse(body);
    var length = jsonData.length;
    var output = [];
      for (let i = 0; i < jsonData.records.length; i++){    // This for loop processes each record and adds it to the array
  callback(null, output);

Zapier loop for each record in view
Update Zapier Zap to Support Line Items