Skip to main content
fetch(url, { method: "POST", headers: headers, body: JSON.stringify(data) })
  .then((res) => {
    return res.json();
  })
  .then((json) => {
    // Do something with the returned data.

    var output = json.apicallsetoutput;
    console.log(output);
    callback(null, output);
  })
  .catch((error) => console.log(error));

For some reason zapier is only taking in the first record of var ouput. Am I missing something to ensure that it is reading all records in output?

Hi @monkeybutton - What you see is totally normal. When you test a code step and the result is an array, only the first result will be shown because each item of the array would trigger the subsequent step separately.


Hi @monkeybutton - What you see is totally normal. When you test a code step and the result is an array, only the first result will be shown because each item of the array would trigger the subsequent step separately.

I am not able to sync all the records to activecampaign though, it is only taking the first result even though I already have at least 50 records in the response of the API call.


I am getting this error when trying to do a test:

 

The email 'email1@email.com, email2@email.com, email3@email.com' is not a valid email.

 

the 3 separate email addresses are returned in the response as individual records in the array.


@ikbelkirasan - Could you chime in here if you get the chance? It seems like we could be close to a solution. Thanks!


Hey @steph.n - Sure, no problem.

@monkeybutton - Did you manage to solve the problem? If not, does it update all the records when the zap is turned on? I think it only works with the first result when you’re building/testing the zap.