Skip to main content
Skip table of contents

Execute JS

Input

✳️ Any (JSON)

Ouptut

✳️ Any (JSON)

Summary

This action allows you to manipulate the raw JSON payload on the workflow pipeline. You can perform advanced calculations, data structure manipulations, sorting, filtering, grouping, and more.

Authoring Your JavaScript

The JavaScript that is entered into this action is automatically wrapped into a function. The special variable input is automatically available.

You must return an object, which will become the input for the next action in sequence.

Limitations

The JavaScript engine that iWorkflow uses is a virtualized environment. Therefore, the following limitations apply:

  • console.write and similar functions do not work.

  • AJAX / Fetch requests do not work.

  • Browser-specific JavaScript APIs (window, document, browser APIs like storage, etc) do not work.

  • Certain execution limits are in place to prevent abuse to our systems. These limits are set fairly high and should not affect normal, day-to-day usage. There are limits on:

    • How long the script can run for

    • How many loop iterations can be executed

    • How many total statements can be run

    • How much memory the script consumes

How It Works

We automatically wrap your code inside a function:

What You Enter

JS
input.newObject = {
  sampleProperty: "Hello, world."
}
if (typeof input.data === 'array')
{
    input.dataCount = input.data.length;
}
return input;

What Is Executed

JS
// Output from previous action
let __lastOutput = {...};

function __execute(input)
{
  input.newObject = {
    sampleProperty: "Hello, world."
  }
  if (typeof input.data === 'array')
  {
      input.dataCount = input.data.length;
  }
  return input;
}

return __execute(__lastOutput);

Properties

Name

Type

Templatable

Notes

JavaScript

Text (JavaScript code)

(error)

Enter the JavaScript code that should be executed. See above for an example.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.