Node
![Document image Document image](https://images.archbee.com/pD-o7nZLwDiSBwGlsHA9q/-pIlm8X-cDIWfmDcFJqfa_image.png?format=webp)
The Node action is one of the actions at your disposal that allows you to execute Javascript code.
Module imports can be performed using CommonJS require('module') syntax only. The list of currently allowed modules can be found below:
Use the return keyword to set the output value. You can return either Single Values or List Values, not both at same time.
Timeout: โ Integer representing execution time limit(when timeout limit is reached, the action will throw an error) Single result: โ Output that will be set for single value outputs. List result: โ Output that will be set for list value outputs. Error: โ String representing errors resulted from the execution of the script (the output is set only when an error occurs, otherwise itโs null)
Something to consider before trying to use the Node action to automate your use cases is that it does not support working with files.
- Create a process and name it.
- Drag the Node action to the canvas and link it to the other actions.
![Document image Document image](https://images.archbee.com/pD-o7nZLwDiSBwGlsHA9q/rawNBVs7ny9GmOy4DkD-A_image.png?format=webp)
3. Create the variables needed for the configuration of the action, and then add them to the configuration panel.
4. Add your Javascript Code to the editor.
5. Configure the output variables which will store the results.
![Document image Document image](https://images.archbee.com/pD-o7nZLwDiSBwGlsHA9q/i0i01-yIBANxb1JgX4-0O_image.png?format=webp)
6. Save, Validate and run.
7. Click Checked Instance to view the results. You will see that the outcome of the interpreted code is saved in the result variable. The script ran without errors so the value of the errorMessage variable is null.
![Document image Document image](https://images.archbee.com/pD-o7nZLwDiSBwGlsHA9q/kxhn4zX_HO1w2K_XNhwjv_image.png?format=webp)
1. Timeout:
Obs: If you set the Timeout to 5 seconds, the action will throw an error at runtime.
2. Scripts with Single outputs.
๏ปฟInteger๏ปฟ
๏ปฟFloat๏ปฟ
๏ปฟString๏ปฟ
๏ปฟBoolean๏ปฟ
๏ปฟJson / DataModel๏ปฟ
๏ปฟDateTime๏ปฟ
Obs: These should only set the Single output. Should work for all types.
3. Scripts with List outputs.
Obs: These should only set the List output. Should work for all types, just like single values. 4. Basic module usage
If the module does not support CommonJS require, we canโt use it
5. Syntax errors
Obs: Syntax errors will only set the Error field. 6. Throw behavior
Obs: Exception messages thrown using throw โmessageโ syntax will show up on the Error field. Only Error will be set after execution. 7. Async / Await
๏ปฟ