Skip to main content
Question

Zapier magically collapses lists with one item

  • October 29, 2023
  • 1 reply
  • 31 views

I’m building a zap which is triggered by invoices. The trigger outputs a record with numbered line items (like a nested dictionary). The test record that I have contains only one line item but there could be many. The attribute that I'm interested in is called "Invoice Line Items".
example:

invoice_number
invoice_date
line_items
  1
    description
    quantity
    price

The next step is "Run Python in Code by Zapier", which I pass the line_items attribute to.

When python reads line_items I was expecting it to see:

1
  description
  quantity
  price

Instead it sees:

description
quantity
price

This works for invoices with one line item but how does it handle invoices with more than one line item? I only have test data for invoices with one line item so I can’t find out by experimentation.

My best guess is that for situations with 2 or more items it will structure it as I expect but would appreciate clarification. I have read lots of docs and tried the zapier ai support bot which got confused.

Pointers much appreciated!

Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Troy Tessalone
Forum|alt.badge.img+14

Hi @keith6202 

Good question.

Zapier pre-parses arrays into variables.

You may need to use Formatter > Utilities > options related to line items.

Help: https://zapier.com/help/create/basics/use-line-items-in-zaps