return array of objects in 'Code by Zapier'
Asked Answered
M

1

6

According to the documentation if I return array of objects subsequent steps will run for each of the objects. So if I return an array of objects that contain email addresses and in the next step send email to that address, emails should be sent to all the addresses.

var output = [
    {id:1, email: '[email protected]},
    {id:2, email: '[email protected]},
    {id:3, email: '[email protected]},
];

But unfortunately only the first email is sent. Can anyone tell me what I am doing wrong?enter image description here

Madoc answered 23/11, 2016 at 18:32 Comment(0)
E
6

If you are referring to the "sample" shown in the editor during the test step, that is because Zapier only shows the first record as a matter of course.

If you turn on your Zap and all 3 items have new IDs never seen before, we'll trigger 3 tasks as a result.

So, to summarize:

  1. We only show the first item in the test section of the editor which can be confusing if you expected all three to show up during editing your Zap.
  2. If the code is for a trigger - only dynamic data (with new IDs) will ever trigger if you turn on the zap.

If those issues aren't the case for your Zap - be sure to contact support at Zapier and refer them to this ticket. They can help track down any bug that you might be experiencing.

Extensible answered 23/11, 2016 at 18:43 Comment(1)
Wow! Thank you. I was manually testing and zapier sent email only to the first object. In live mode it worked!Madoc

© 2022 - 2024 — McMap. All rights reserved.