Function
The Function connector allows you to execute custom JavaScript code within a workflow. It is useful when advanced data processing or custom logic is required that cannot be handled using standard connectors.
The Function connector runs using Node.js, enabling you to manipulate workflow data, perform calculations, filter information, or transform JSON structures before passing the results to the next connector in the workflow.
This connector is typically used for tasks such as:
transforming input data
performing calculations
restructuring JSON objects
preparing data for external API requests
applying custom logic to workflow data
After the code is executed, the processed output is passed to the next connector in the workflow.
JavaScript
The Code node supports Node.js.
Supported JavaScript features
The Code node supports common JavaScript functionality, including asynchronous operations.
Promises: Instead of returning the items directly, you can return a promise which resolves accordingly.
Console Logging: You can print debug information using
console.log. This allows you to inspect data during execution and helps with troubleshooting workflow behavior.
Built-in methods and variables
iMBrace's workflow provides built-in methods and variables for working with data and accessing n8n data. The syntax to use the built-in methods and variables is $variableName or $methodName(). Type $ in the Code node or expressions editor to see a list of suggested methods and variables.
Last updated