We grant multiple automations and courses upon a purchase webhook. We currently pull a row out of a Google sheet to see which items we need to grant. I've been isolating the relevant columns for Teachable by using Javascript code. Code is below, with some example data (of course in my real flow, this data was mapped, not plain text). When we closed shop on the 22nd, this code was working and returning an array of just the teachable column contents. However, at some point during the holidays it started returning an error, saying that there was an additional '}'.
At first I thought there was an issue with the data, and even tried to manually add an array to test it, but it still didn't work. After much trial and error, I am convinced there is something wrong with the current Pabbly JavaScript implementation. For now, I've switched all this code to Python and it works fine (same data). Examples can be found below in the routes of this flow: https://connect.pabbly.com/workflow/mapping/IjU3NjUwNTZlMDYzZTA0M2M1MjZlNTUzYzUxM2Ei_pc
However, @Pabbly, please look into this and let me know if there's something wrong with your code.
I would also welcome suggestions on how to isolate only columns marked with "Teachable Contents" from the objects I'm returning with Google sheets with inbuilt Pabbly tools, to avoid similar breakages in future.
Many thanks,
Anastasia
At first I thought there was an issue with the data, and even tried to manually add an array to test it, but it still didn't work. After much trial and error, I am convinced there is something wrong with the current Pabbly JavaScript implementation. For now, I've switched all this code to Python and it works fine (same data). Examples can be found below in the routes of this flow: https://connect.pabbly.com/workflow/mapping/IjU3NjUwNTZlMDYzZTA0M2M1MjZlNTUzYzUxM2Ei_pc
However, @Pabbly, please look into this and let me know if there's something wrong with your code.
I would also welcome suggestions on how to isolate only columns marked with "Teachable Contents" from the objects I'm returning with Google sheets with inbuilt Pabbly tools, to avoid similar breakages in future.
Many thanks,
Anastasia
function extractTeachableContents(arrayOfObjects) {
let teachableContentsValues = [];
if (arrayOfObjects.length > 0 && arrayOfObjects[0].hasOwnProperty('rowValue')) {
let rowValueObject = arrayOfObjects[0].rowValue;
for (let [key, value] of Object.entries(rowValueObject)) {
if (key.includes('Teachable Contents') && value != "-" && value != "") {
teachableContentsValues.push(value);
}
}
}
return teachableContentsValues;
}
// Usage example
let arrayOfObjects = 4. Response Result : [{"rowIndex":303,"rowValue":{"Product ID":"261538","Product Name":"The Natural Solution Series – Platinum – Premium (One-Time-Offer)","Checkout Link":"Checkout / Thanks / Upsell 1 / Upsell 2 / Upsell 3","Launch Specific AC Automation - Purchase":"TNS - 2023 - November - Purchase (626)","Launch Specific AC Automation - Refund":"TNS - 2023 - November - Refunded (627)","Your Logins?":"Your Logins (503)","AC Automation - Purchase":"TNS - Platinum - Premium - Purchase (630)","AC Automation - ...;
output = extractTeachableContents(arrayOfObjects);