Best answer

Using line item fields from webhook trigger

  • 2 June 2021
  • 2 replies
  • 86 views

Hey Zapier family,

 

I’ve been digging into using webhooks with a JS application i’ve been developing, to sync the data to our crm and generate some PDFs in real time.

 

The thing I’m struggling with is on the webhook catch quoting side.  A client can submit a quote and then I need to pass those line items on to the next step.  The line items will vary, and the number of line items will vary. 

 

So using mock data, i’ve got something like this:

 

If I wanted to send each person quoted to a google spreadsheet, how would I do that?

The zap only allows mapping of the children [0] of the array, not like “for all first names” do this.

 

 

Basically how would I use a webhook to accomplish essentially a for loop in js?

 

 

Any help pointing me in the right direction would be great!

 

Thanks

Ben

icon

Best answer by william 16 July 2021, 04:00

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +11

Hi @bwright 

Looks like each of the line items from the trigger app get convert to their own fields (e.g. [0], [1], [2]) instead of staying structured in an array.

You may have to build out a Code step to combine all the possible separate line items into a proper array.

https://zapier.com/apps/code/help

 

Userlevel 3
Badge +6

Hey @bwright, I hope you’re doing well, I just wanted to check in here!

Were you able to get this working, or can we still help out here?

From the description and the information provided by Troy, I believe a good solution here may be available with our standard integrations.

For example, you could use our Formatter’s Line Itemizer action to convert these individual items into a proper line item array: https://zapier.com/help/create/format/create-line-items-in-zaps

Once you have that array, you could then use a Looping by Zapier action to loop your zap based on those line items: https://zapier.com/help/create/other-functions/loop-your-zap-actions

As Troy mention though, using a code step to convert the data into a proper array and then loop through the data would like be the most efficient approach: https://zapier.com/apps/code/help

If you’re needing to perform actions in a loop based on that array, you can use the line itemizer linked above, or a code step as linked by Troy to get a proper array. From there you would send that array into a Looping by Zapier action to loop whatever actions you need based on that line item array.