Question

Fields Duplicating

  • 30 December 2023
  • 3 replies
  • 55 views

Badge

Having an issue with input fields being duplicated when testing an action. The fields are child fields and appear correctly as seen in the image below.

 

 

When I run a test with the data from the screenshot, the two fields are being duplicated in the bundle.inputData json. They show as both in the header as well as the Item obj sublist. Not sure what I set up incorrectly.

 

bundle inputData { recType: 'salesOrder', rate: '9', quantity: '2', item__obj: [ { rate: '9', quantity: '2' } ] }

 

Appreciate any input on how to set them to only appear within the item__obj list.


3 replies

Userlevel 3
Badge +6

Hey @TavDev , 

I apologize as this isn’t documented very clearly, but Zapier intentionally duplicates child fields at the top level of the bundle so they can be referenced directly when crafting the request payload.

In the request, are you currently referencing or spreading bundle.inputData?

If so, to avoid the duplicates, you’ll need to either:

  • Craft a more specific payload, referencing the specific fields you want included in the request, or…
  • Write some code to filter out the fields that appear in both bundle.inputData and as child fields

If you run into questions, feel free to reach out to our Platform Support team. They’ll be glad to take a closer look and offer suggestions: https://developer.zapier.com/contact

Badge

Thanks @connorz,

 

Follow up question: As this is a sublist of a transaction, how are we to handle like named fields that may exist at the header level as well as a line level? e.g. Amount, Taxes, etc. These fields on the lines would potentially have the same api fieldname as their header counterparts. I wouldn’t want to delete the header value for Amount, for example. But I would want to filter out the duplicated line fields from the header that should not be there. 

Userlevel 3
Badge +6

Hi @TavDev , 

For this, I might suggest filtering based on keys rather than field labels. 

All keys, including child keys, must be unique. In other words, a top-level field and a child field can’t use the same key. 

By filtering on keys, you should be able to catch and filter out true duplicates. 

Reply