Script Action

Modified on Tue, 9 Apr, 2024 at 12:18 PM

The "Script Activity" empowers you to incorporate custom JavaScript code into your workflows, allowing you to execute additional processes. However, it's important to note that script activities within a workflow are subject to a maximum execution time of 1 second. Any script activity exceeding this time limit will be forcibly terminated.


You have the capability to return multiple results from your script by attaching them to the global "exports" object. For instance:

exports.results = ...;
exports.more_results = ...;

Furthermore, you can access the outputs generated by previously executed activities within the workflow using the "getActivity" function. For example:

$.getActivity('find-users-1');

In the following example, we access the results from a prior "Find Users" activity. We then loop through each result, identifying users whose usernames begin with 's,' and export only those users.

const users = $.getActivity('find-users-1').users;
let i;
let begin_with_s = [];
for (i = 0; i < users.length; i += 1) {
  if (users[i].username.charAt(0) === 's') {
    begin_with_s.push(users[i]);
  }
}
exports.users = begin_with_s;

The resulting output of this script can subsequently serve as the recipients for the "Send Heed" activity within your workflow.



NPM Modules

You script activity has access to the following Node/NPM modules:

  1. url
  2. lodash
  3. moment
  4. node-html-parser
  5. uuid

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article