Hi Pabbly Team,
We're encountering a persistent issue with the "Code by Pabbly -> Run JavaScript (Beta)" action step (currently Step 8) in our workflow [Optional: Add Workflow ID if easily available] and need assistance.
Workflow Context:
The overall goal is to send personalized newsletters. Inside an Iterator loop (Step 6, iterating over subscribers from Step 2), we have a Filter (Step 7) checking for active status. Step 8 (the Code step) is intended to:
The Problem(s) in Step 8 (Run JavaScript):
We are currently blocked from using the "Run JavaScript" step effectively because: a) The standard Input Data Mapping UI section seems to be unavailable. b) The alternative inline mapping method fails with SyntaxErrors when mapping array data from a previous API step ({{4.data}}).
Request:
Could you please investigate why the Input Data Mapping section might be missing for this step instance in our workflow? Alternatively, could you clarify the correct syntax or method for reliably passing an array (like {{4.data}}) returned from a previous API step into the Javascript code environment using the inline mapping method without causing SyntaxErrors during parsing?
We have already attempted standard troubleshooting like Refresh Fields, re-testing previous steps, and browser refreshes.
Thanks for your help.
We're encountering a persistent issue with the "Code by Pabbly -> Run JavaScript (Beta)" action step (currently Step 8) in our workflow [Optional: Add Workflow ID if easily available] and need assistance.
Workflow Context:
The overall goal is to send personalized newsletters. Inside an Iterator loop (Step 6, iterating over subscribers from Step 2), we have a Filter (Step 7) checking for active status. Step 8 (the Code step) is intended to:
- Receive the full list of articles (an array of objects fetched in Step 4 via API, output as {{4.data}}).
- Receive the current subscriber's preferred tags (a comma-separated string from the Step 6 Iterator, output as {{6.preferred_tags}}).
- Receive a cutoff date string (from Step 3 Date Formatter, output as {{3.result}}).
- Filter the allArticles array based on the cutoffDateString and tag overlap with subscriberTagsString, returning the top 3 matches.
The Problem(s) in Step 8 (Run JavaScript):
- Missing "Input Data Mapping" UI: The primary method we expected to use for passing data into the Javascript environment – the key-value mapping section typically found below the code editor box – appears to be missing or inaccessible in the UI for this step instance. We have scrolled down and checked carefully, but cannot find the section to define input keys (like all_articles) and map values ({{4.data}}). This prevents us from using the standard method of passing data via the function argument (async function run(input_data)).
- Inline Mapping Syntax Errors: Based on Pabbly examples suggesting inline mapping is possible (inserting {{...}} tags directly into the code), we attempted this:
JavaScript
async function run() {
const allArticles = {{4.data}} || [];
const subscriberTagsString = "{{6.preferred_tags}}" || '';
const cutoffDateString = "{{3.result}}";
// ... rest of filtering logic ...
}
While mapping the simple string values ({{6.preferred_tags}}, {{3.result}}) within quotes seems okay, including the array mapping {{4.data}} consistently results in SyntaxError: Unexpected token '{' (or similar, like Unexpected token 'l') when testing the step. This suggests Pabbly's replacement of the {{4.data}} tag (which represents a JSON array [{...},{...}]) is generating code that the Node.js v18.x environment cannot parse correctly before execution. Attempts to wrap {{4.data}} in JSON.parse() also resulted in similar syntax errors.
We are currently blocked from using the "Run JavaScript" step effectively because: a) The standard Input Data Mapping UI section seems to be unavailable. b) The alternative inline mapping method fails with SyntaxErrors when mapping array data from a previous API step ({{4.data}}).
Request:
Could you please investigate why the Input Data Mapping section might be missing for this step instance in our workflow? Alternatively, could you clarify the correct syntax or method for reliably passing an array (like {{4.data}}) returned from a previous API step into the Javascript code environment using the inline mapping method without causing SyntaxErrors during parsing?
We have already attempted standard troubleshooting like Refresh Fields, re-testing previous steps, and browser refreshes.
Thanks for your help.