Run Code

Description

The Run Code action allows a flow to execute a JavaScript script to perform complex operations.

The Run Code action can also be used for specific cryptography requirements by using tools from the Forge library. For more details, see Run Code action using Forge cryptography library.

Usage

Run Code

The Run Code action executes a script in JavaScript. Most of the operations are allowed to perform complex operations and data transformations in a simple way.

Note: Importing libraries, dealing with files, blobs and proxies, using constructor, fetch or eval and doing HTTP requests is not allowed.

Inputs

In cases where data is needed to be provided from templating, you must set it using the Inputs section. There is no limit to adding variables, but note that there is a limited number of operations that can be executed. Note that inputs are declared as global variables and they can be overridden in the code.

Test action

When adding the Run Code action to a flow, you can test the action without needing to trigger the complete flow using the Test action button.

Once you click the Test action button, a new window prompts you to provide the value of the variables resolved through templating.

Run Code test input

When you click the Test action button, the script is executed and the output is prompted in a new window as shown below:

Run Code test output

Action limits

To allow the correct performance of the action, the following limits must be taken into account:

Action limit Value Description
Maximum allowed depth of recursion 100 This means that recursive scripts will only be allowed to execute 100 levels of depth.
Script execution Up to 5 seconds Otherwise, the execution will fail with a timed-out result.
Maximum size allowed for arrays 100K elements
Maximum number of statements 5000 This includes variable declarations, conditional blocks, loops, function calls and such.
Maximum memory allocation ~10MB This means that a script has up to 10 MB of memory to execute.