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.
See an example of a JavaScript tutorial here.

Procedure

To incorporate the Function block into your workflow, complete these steps:

  1. Drag and drop the Function block onto your chosen location in the workflow.
  2. 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;
  3. 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.