The Script Node enables custom code execution within a workflow. By writing JavaScript or Python code, it processes input data and returns results—ideal for data transformation, formatting, complex calculations, and business logic processing.
Adding the Node
Method 1: Add via the + Button
-
Hover over any node on the canvas (e.g., the Start Node); a
+button automatically appears on its right side. -
Click the
+button, then select Logic Script from the pop-up node list. The node is automatically added to the canvas and connected to the upstream node.
Method 2: Drag from the Node Library
- In the left-hand node library, locate and select Logic Script.
- Drag the node onto the canvas at your desired location, then drag a connection line from the edge of an upstream node to this node.
Core Configuration
Inputs
Define the input variables the script node will process. Click Add Variable to add an input parameter. Each input parameter includes the following settings:
| Parameter | Description |
|---|---|
| Variable Name | The name of the input variable, used to reference it in your code. |
| Reference Mode | Input: Enter a static value directly; Reference: Reference an output variable from an upstream node. |
| Value | The value of the input variable. When Input is selected, enter a static value directly; when Reference is selected, type / in the field to trigger variable auto-completion—supporting references to upstream node outputs. |
Code
Write the core logic in either JavaScript or Python.
| Language | Description |
|---|---|
| JavaScript | Runs on the V8 engine and supports ECMAScript 2022 syntax. Selected by default. |
| Python | Supports the Python standard library—well-suited for data processing and computation. |
Retry on Failure
Disabled by default. When enabled, the node automatically retries upon timeout or runtime error. When disabled, failures result in immediate errors.
| Parameter | Range | Default | Description |
|---|---|---|---|
| Max Retry Count | 1–10 | 3 | Maximum number of retries on failure. |
| Retry Interval | 300–10,000 ms | 500 | Delay between retry attempts. |
Error Handling
Disabled by default. When enabled, custom logic executes upon node failure.
| Handling Strategy | Description | Default Value |
|---|---|---|
| Output predefined content on error. Requires configuring a default return value in valid JSON format. | Error Branch | On error, the error branch executes. Selecting this option automatically creates an error branch—you must configure its downstream processing flow. |
Node Outputs
The dictionary returned by the script’s return statement becomes the node’s output. Output variables must be manually defined in the configuration panel. Click Add Variable to define an output variable. Each output variable includes the following fields:
| Parameter | Description | Variable Name |
|---|---|---|
Name of the output variable—must exactly match a key in the object returned by return. | Type | Data type of the output variable (e.g., Number, String, etc.). |