# 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.

<figure><img src="https://1398472304-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcJYkTyk9qgh7aCR6dHIm%2Fuploads%2FC9evrMkbmY3oL0xXCnBg%2Fimage.png?alt=media&#x26;token=de1cbfdb-61c0-48f6-85a0-61d3ba0aa02c" alt="" width="349"><figcaption><p>Execute Javascript Action</p></figcaption></figure>

#### Output and Wildcards

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

* [{stream.last\_result}](https://docs.helmut.de/helmut4-releases/helmut4-components/streamdesigner/wildcards/result-or-return-wildcards-2/stream-last_result)
* [{node.result.?}](https://docs.helmut.de/helmut4-releases/helmut4-components/streamdesigner/wildcards/result-or-return-wildcards-2/node-result)

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}](https://docs.helmut.de/helmut4-releases/helmut4-components/streamdesigner/wildcards/result-or-return-wildcards-2/stream-last_result) or [{node.result.?}](https://docs.helmut.de/helmut4-releases/helmut4-components/streamdesigner/wildcards/result-or-return-wildcards-2/stream-last_result):

```javascript
var myInput = "test1234";
var myOutput = myInput;

myOutput;
```

#### 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.
