Skip to main content

I have a made a Search action on the Zapier Platform UI that sends a Post request for Payroll Period IDs to my application. The application holds this data as an array of line items containing the id, the technician name, and other pertinent information.

Originally it would only return the first line item rather than the entire array. I was able to fix this (as pictured) by reformatting the data coming in as an array. Unfortunately, when I use the Search function in a zap, it still only returns the first value that it finds.

My goal is to ultimately be able to Send a Post request to this API once a week on Tuesday and retrieve all of the Payroll Ids to use in an additional step. The additional step, however, presents data in the same way so it will run into the same exact problem.

I am not sure if I am approaching this problem wrong, or if there is something that I could do to reformat the data coming in to work better with Zapier.

All the best,

Jacob

Line Items Returned.jpg


Hi @jacob_nolley 👋

If you use Formatter app to search data in a Zap, it will only return the first instance of that data, it sounds like that's what you've run into here, is that right?

Could I ask what you're searching for and how you need to use that data in the next part of the Zap? That will help us to think about the next thing to try.

Could I also ask, are you using the Developer Platform because you're developing an app for release or are you using it so that you can work with an app in the way that you need (ie you're making something for private use)? Thanks!



Hey @Danvers,


I am working on something for private use because the app is not integrated into Zapier as of now. The Search step I have created is an action step of the app that I made in developer rather than a formatter step. The Zap I am looking to create is as follows:


1) Scheduler by Zapier triggers on Tuesday at 1am.

2) A Search action looks for all of the technician Payroll Ids for a given time period. (THIS IS THE PROBLEM STEP) -> Basically it is returning the name, time frame, and id of only 1 technician rather than a list of line items for all technicians.

3) An Action step adds all of the ids as individual new rows in a google sheet using line item support.


From my previous picture you can see that after I wrapped the data in an array, I was able to retrieve all of the data from the developer platform. The problem is that when I saved and went to Zapier to create a zap and try the search step, it still only returns the values of 1 technician (even with the exact same input data).



UPDATE: I have included photos of the code I am using, the results I am getting in the platform, and then the results I am getting in my zap step within Zapier. You can see how only the first result shows up in Zapier but they all do in the platform test.

ZUNH4TSDOGPG.jpgScreen Shot 2020-03-11 at 8.25.09 AM.png



Hi @jacob_nolley 

When you return an array of objects from an action, each object is passed down to the subsequent steps as a separate task. This is why you only see the first one when you test that step in your zap.

So, in order to pass all the line items at once to the next step, you should return something like the following:

return r
  {
    items: results // results should be an array of objects
  }
];

Hope this helps.


Hey @ikbelkirasan,

 

IT WORKED! Thank you so much.

 

Because it only showed 1 result, I thought it wasnt working. I was just misunderstanding that it was giving me a piece of sample data to work with!


@jacob_nolley - Exactly, that the best way to describe it! Glad it helped you :)