How to correctly return a list of dictionaries in

2019-07-28 02:38发布

问题:

The Zapier code documentation says that the output of a code zap can be either a dictionary or a list of dictionaries (See "Data Variable" section: https://zapier.com/help/code-python/).

When doing this,

output = [{'Booking':'Shirt'},{'Booking':'Jeans'}]

the output of the code returns only the first dictionary, however:

runtime_meta__duration_ms:  2
runtime_meta__memory_used_mb:   22
id: [redacted]
Booking:    Shirt
Fields with no value:
runtime_meta__logs

What am I doing wrong here? Thanks a lot!

回答1:

David from the Zapier platform team here. Code steps returning an array is a mostly undocumented (because there's no UI support and it's confusing, as you can tell) feature.

When testing, it'll only show the first item in the array. When it runs for real, all steps after the code step will run for each item in the array. The task history will reflect this

So set up the zap and turn on and it'll work like you expect.

Sorry for the confusion and let me know if you have any other questions!



标签: zapier