1001fx - NoCode functions icon

1001fx - NoCode functions

1001fx is a set of functions for any automation platform. Our functions are simple, very well tested, scalable and offer features that most automation platforms do not offer.

Actions74

code → Execute Javascript Code

AI-generated

Overview

This node allows you to execute custom JavaScript code within your n8n workflow. It is particularly useful for scenarios where you need to perform calculations, data transformations, or logic that is not available through standard n8n nodes. For example, you can use this node to manipulate incoming data, filter arrays, or generate dynamic outputs based on complex conditions.

Practical examples:

  • Calculating a new field from input data (e.g., sum of two fields).
  • Filtering or mapping arrays.
  • Formatting dates or strings.
  • Any custom logic that can be expressed in JavaScript.

Properties

Name Meaning
Code Code to be executed. Has to be valid JavaScript code. Store the result in a variable and just write the variable in a single line at the end to return the value.

Output

  • The output will be the result of the executed JavaScript code, returned as the json field of the node's output item.
  • The structure of the output depends entirely on what your code returns. It could be a string, number, object, array, etc.
  • If your code throws an error, the output will contain an error field with the error message.

Example output:

{
  "json": {
    "result": 42
  }
}

or, if an error occurs:

{
  "json": {
    "error": "ReferenceError: x is not defined"
  }
}

Dependencies

  • Requires a valid API key/credential for "1001fxApi" to be configured in n8n.
  • No external services are required for code execution itself, but the node is part of a larger set of functions that may require internet access.

Troubleshooting

  • Common issues:

    • Syntax errors in the provided JavaScript code will cause the node to fail.
    • Returning undefined or not returning a value will result in empty output.
    • Using unavailable variables or functions will throw reference errors.
  • Common error messages:

    • "ReferenceError: ... is not defined": Check your code for typos or missing variable declarations.
    • "SyntaxError: Unexpected token ...": Ensure your JavaScript code is valid.
    • "Error: Cannot read property ... of undefined": Make sure you are accessing properties on objects that exist.

How to resolve:

  • Double-check your JavaScript code for correctness.
  • Test your code in a safe environment before using it in the node.
  • Use try/catch blocks in your code if you want to handle errors gracefully.

Links and References

Discussion