• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

Different behavior of JavaScript code module during test and normal workflow execution

Your Task History ID
IjU3NjAwNTZhMDYzNjA0M2Q1MjY0NTUzNzUxMzI1MTYyNTQzNiI_3D_pc
I can't make way past a problem with the behavior of the Pabbly Connect JavaScript code module.

I need to pass a series of parameters to Crove to pre-fill a contract and send it for signature. Charanjit (Crove co-owner) confirmed to me there is an issue with the Pabbly integration which prevents it from passing properly formatted JSON, so I decided to compose the JSON semi-manually using the JavaScript code module.

The problem is that some of the fields may be empty during execution. A very simplified version that illustrates my problem:

let data = { "Course1" : "2. Line Items 0 Acf Fields Course Name Bul : Концептуално изкуство с Photoshop", "Course2" : "2. Line Items 1 Acf Fields Course Name Bul : Концептуален дизайн на среда", "Course3" : "2. Line Items 2 Acf Fields Course Name Bul : Концептуален дизайн на персонажи" }

This will perform under test (Save & Test during workflow design) even if the mapped variables for lines 2 and 3 are empty. The JSON will simply leave empty space, which is exactly what is required. However, when the workflow is executed automatically, the JS code module will produce the following output:
SyntaxError: Unexpected identifier
and although the workflow will continue afterwards, it will pass an empty JSON object which will of course fail to generate the contract in Crove due to missing data.

I tried to work around past that as a quick patchfix by attempting to pass my values through a Text Formatter -> Default value, with the idea that if the mapped data is empty, it will absorb that and simply return an empty string. But I can't do that because the Text Formatter -> Default value returns an error saying 'Empty Default Value'. Well, duh! What's wrong with wanting to have an EMPTY default value?!

So... as is apparent, I have several issues to solve. My whole approach is bad because I need to work with 12 sets of 5 data components, and for the life of me I can't figure out how to pass them through an iterator (so that I can have 5 iterators).

Bottom line: I need to know first and foremost why there is different behavior of the JS code module between manual execution (Save & Test in workflow design mode) and normal execution, when both operate on the same data set. If that is a bug that Pabbly can confirm and fix, it would be great. If not a bug, I will need help figuring out a way past that, short of ditching Pabbly completely for this project and writing my own PHP script to do that.

I have provided below links to the problematic workflow and task history. I hope what I wrote makes sense and that somebody will look into it, as it drives me crazy :(

Thanks in advance!

Ivan
 

Supreme

Well-known member
Staff member
Hey @Ivan Arnaudov

Please check the JSON you have provided, as we can see from it, the JSON has double quotes inside and another double quotes which is why it is breaking the payload.

Also, we can see you are trying to create the JSON in the JS code, so kindly try that in the API by the Pabbly action step.

1687263022949.png


So, kindly consult with a developer and then try with Code.
 
Hey @Ivan Arnaudov

Please check the JSON you have provided, as we can see from it, the JSON has double quotes inside and another double quotes which is why it is breaking the payload.

Also, we can see you are trying to create the JSON in the JS code, so kindly try that in the API by the Pabbly action step.

View attachment 27545

So, kindly consult with a developer and then try with Code.
Thank you, noticing the double quotation marks was spot on. I've taken measures to sanitize my inputs to avoid such issues in the future.

I produced the JSON as a temporary solution because there is something wrong with the Pablly integration for Crove, as I said. Now that my workflow is working, I will have more time to analyze the problem and report it to Pabbly.
 
Top