Function
The Function block is used to run raw JavaScript code within a NodeJS environment.
You can use the Function block for quick calculations, including the following examples:
- Mathematical expressions and formulas
- Date and time manipulations
- Units and conversions calculations
- String parsing and manipulation
- Regular expressions (regex) operations.
Procedure
To incorporate the Function block into your workflow, complete these steps:
- Drag and drop the Function block onto your chosen location in the workflow.
- Enter raw JavaScript code into the Function block. For example, enter the following JavaScript code:
1 var d = new Date();2 var n = d.getFullYear();3 $sample_variable=($A3.result+42)/n; - Run the workflow to apply the changes.
Note: The total execution time of the script is capped at one second. If the execution time surpasses this limit, this error message is displayed: Script execution timed out after 1000ms.
Disabling Function block
To temporarily disable the Function block without deletion, turn off the switch in the block header.