Creating Airtable records with line item support did not work. It only sees 1 line with multiple info inside.
I tried to add 3 steps to my ZAP to reformat the item list. The individual tests work fine on ZAPIER, but when the Zap plays in real life after publishing the ZAP, the step to parse into object says error = "SyntaxError: Unexpected token \ in JSON at position 1" because ZAPIER sees backslashes when the tests did not. The step to “unescape Quotes” is supposed to get rid of that error, but it seems that ZAPIER still sees extra backslashes in the input data, when the tests results don’t show any.
Can anyone help understand and fix this ?
Below are the 3 steps added to my ZAP to reformat the item list:
- to Create array from "capteurs" string {xxxx},{xxxx},.…
// this is wrapped in an `async` function // you can use await throughout the function //output = JSON.parse(inputData.capteurs); // stores an array of any length (0 or more) with the matches var matches = inputData.capteurs.match(/\{r^\}]+\}/g) // the .map function executes the nameless inner function once for each // element of the array and returns a new array with the results // {str: 'loYm9vYzE6Z-aaj5lL_Og539wFer0KfD'}, ...] return (matches || (]).map(function (m) { return {str: m} })
Results as seen on ZAPIER-test : str {"Nom du site":"site 1","Nom du capteur":"nom capteur 1","Cas d'usage du capteur":"Consommation énergétique au compteur (GAZ)"}
vs Results as seen on ZAPIER-real, with backslashes : str {\"Nom du site\":\"1\",\"Nom du capteur\":\"nom capteur 1\",\"Cas d'usage du capteur\":\"Consommation \u00e9nerg\u00e9tique au compteur (GAZ)\"}
Results as seen on ZAPIER-test : capteurs {"Nom du site":"site 1","Nom du capteur":"nom capteur 1","Cas d'usage du capteur":"Consommation énergétique au compteur (GAZ)"}
vs Results as seen on ZAPIER-real, with backslashes : capteurs {\"Nom du site\":\"a\",\"Nom du capteur\":\"1\",\"Cas d'usage du capteur\":\"Consommation \u00e9nerg\u00e9tique au compteur (GAZ)\"}
- to Parse into object "capteurs" {xxxxx}
output = JSON.parse(inputData.json);
Results as seen on ZAPIER-test :
Nom du site site 1
Nom du capteur nom capteur 1
Cas d'usage du capteur Taux de remplissage des points d'apports volontaires
vs Results as seen on ZAPIER-real: error = "SyntaxError: Unexpected token \ in JSON at position 1"
Hi @DPA
Good question.
Airtable supports creating records with line items.
However, Creating Airtable records with line item support did not work. It only sees 1 line with multiple info inside.
I tried to add 3 steps to my ZAP to reformat the item list. The individual tests work fine on ZAPIER, but when the Zap plays in real life after publishing the ZAP, the step to parse into object says error = "SyntaxError: Unexpected token \ in JSON at position 1" because ZAPIER sees backslashes when the tests did not. The step to “unescape Quotes” is supposed to get rid of that error, but it seems that ZAPIER still sees extra backslashes in the input data, when the tests results don’t show any.
Can anyone help understand and fix this ?
Below are the 3 steps added to my ZAP to reformat the item list:
- to Create array from "capteurs" string {xxxx},{xxxx},.…
// this is wrapped in an `async` function // you can use await throughout the function //output = JSON.parse(inputData.capteurs); // stores an array of any length (0 or more) with the matches var matches = inputData.capteurs.match(/\{.^\}]+\}/g) // the .map function executes the nameless inner function once for each // element of the array and returns a new array with the results // i{str: 'loYm9vYzE6Z-aaj5lL_Og539wFer0KfD'}, ...] return (matches || r]).map(function (m) { return {str: m} })
Results as seen on ZAPIER-test : str {"Nom du site":"site 1","Nom du capteur":"nom capteur 1","Cas d'usage du capteur":"Consommation énergétique au compteur (GAZ)"}
vs Results as seen on ZAPIER-real, with backslashes : str {\"Nom du site\":\"1\",\"Nom du capteur\":\"nom capteur 1\",\"Cas d'usage du capteur\":\"Consommation \u00e9nerg\u00e9tique au compteur (GAZ)\"}
Results as seen on ZAPIER-test : capteurs {"Nom du site":"site 1","Nom du capteur":"nom capteur 1","Cas d'usage du capteur":"Consommation énergétique au compteur (GAZ)"}
vs Results as seen on ZAPIER-real, with backslashes : capteurs {\"Nom du site\":\"a\",\"Nom du capteur\":\"1\",\"Cas d'usage du capteur\":\"Consommation \u00e9nerg\u00e9tique au compteur (GAZ)\"}
- to Parse into object "capteurs" {xxxxx}
output = JSON.parse(inputData.json);
Results as seen on ZAPIER-test :
Nom du site site 1
Nom du capteur nom capteur 1
Cas d'usage du capteur Taux de remplissage des points d'apports volontaires
vs Results as seen on ZAPIER-real: error = "SyntaxError: Unexpected token \ in JSON at position 1"
@DPA
It would be helpful to have screenshots with how each of your Zap steps are configured to make sure we have proper context.