Execute Javascript Action

The Execute JavaScript Action node runs JavaScript code using Nashorn, enabling powerful custom logic and integrations directly inside a stream.

Its primary purpose is to integrate Helmut with third-party systems where no dedicated action node exists yet. Typical use cases include custom API calls, data transformation, conditional logic, or generating values that are reused later in the workflow.

If you need assistance building a specific integration, please contact MoovIT GmbH.

Input Parameters

JavaScript JavaScript code executed via the Nashorn engine.

Execute Javascript Action

Output and Wildcards

The return value of the script is provided as the node result and can be accessed via:

To return a value, ensure the last expression in your script evaluates to the desired output.

Nashorn Overview and Limitations

Nashorn is the JavaScript engine included with Oracle Java 8–14. It implements ECMAScript 5.1 and supports only a limited subset of newer JavaScript features.

ECMAScript Support

  • Full ECMAScript 5.1 support

  • Partial ECMAScript 6 support (limited features such as some arrow functions or template literals)

  • No modern features such as classes, modules, and most ES2017+ syntax

Performance Considerations

  • Scripts are compiled to bytecode at runtime, which can cause a small startup delay for larger scripts

  • Usually negligible, but should be considered for heavy or frequent execution

No Browser APIs

  • Nashorn does not provide browser objects like window, document, or DOM APIs

  • Scripts must use plain JavaScript logic (or JVM-provided functionality, if available)

Example

The following script returns a value which can then be used via {stream.last_result} or {node.result.?}:

Typical Use Cases

  • integrating with third-party systems without dedicated Helmut nodes

  • transforming metadata values (formatting, parsing, mapping)

  • building custom identifiers or filenames

  • conditional logic and decision making within a stream

  • preparing JSON payloads for HTTP Request nodes

Practical Tip

Keep scripts small and focused. If you need complex logic, consider splitting it into multiple nodes or using a dedicated external service—this makes workflows easier to maintain and troubleshoot.

Last updated