Trigger Zap Button Clicked - works in test, not in publish
I am catching a web hook and saving the data immediately to a table. A button is added as part of the record that triggers a zap for processing. All this is so I can have more control over unknown data coming in.
Importantly, I am saving the raw json data in a text field since I want to use my own processing of the raw string.
In edit / test mode, ‘Trigger Zap Button Clicked’ just captures the raw json data. In the published live version, the same trigger somehow detects the json data and parses it into an array, messing up the whole zap. Why?
Minor question: why does the trigger output an array with key ‘new’ and an array with the key ‘old’?
I can resolve the issue by enclosing the json in quotes when saving to the table. Still curious to know why the automatic parsing in the published version.
@mcaranti
Can you post screenshots from the Zapier Table and Zap giving us examples for more context?
@mcaranti
Have you tried using this field type: JSON
Store and validate JSON-formatted content.
Hi there @mcaranti
Did Troy’s suggestion of using a JSON field type in the table instead of a text field do the trick?
Eager to ensure you’re all set so please keep us updated on how it went!
Hi @SamB @Troy Tessalone . Sorry for the delay!!
Yep, I tried the JSON field type, but it automatically parses the JSON data into an array when pulled into a zap and so, in Code by Zapier, I would need a separate value set for each field. I need to use Code by Zapier to do some pre-processing and it is easier to work with one Input Data value set for the raw JSON than to have a different value set for each field. See screenshot.
If there are no single-quotes around the json text, unlike in the image above, Zapier does not parse the data automatically parse the data in Draft mode but it does recognize and parse the data in the Published version. The result is that the test works in draft mode, but once the Zap is published, the ‘body’ value set points to one of the data fields instead of raw JSON text.
Issue is resolved by adding the single quotes.
No worries, @mcaranti—thanks for getting back to us!
Sorry to hear that JSON field won’t work for your needs here. It is strange how it handles it differently in the Zap editor verses when the Zap runs live. I suspect it could well be a bug so, as Troy mentioned previously, it’s worth flagging this potential bug to the Tables team here so they can investigate this further.
Really glad you found a workaround for now though—great work on that!
In reading back the full thread here, I spotted you also asked:
Minor question: why does the trigger output an array with key ‘new’ and an array with the key ‘old’?
Sorry for missing that previously! Those New and Old arrays are to help indicate what changes have been made to a record by allowing you to see the previous (old) values that were stored for the record, as well as it’s current (new) values. This is often useful in cases where a record might be marked with a different status and a filter is checked to see if a record moved from one particular status to another. Hope that helps to clarify things.
Do let us know if there’s anything else we can assist with in the meantime!
Hi @SamB! Thanks for explaining the New and Old arrays. I actually might have a use case for that.
You’re very welcome @mcaranti! If you run into any issues while exploring that use case, feel free to reach out—I’d be happy to help!