Skip to content
← All scripts
Flow actionscoped scopeReview before use · not yet release-tested

Flow Designer: a script step with clean inputs and outputs

A reusable custom action script step that validates inputs, does one job, and returns clear outputs and errors the flow can branch on.

October 1, 2026 · #flow-designer #custom-action #integrationhub

Script steps in custom actions are where flows get their power. Keep each one small, typed and honest about failure.

// Custom action · Script step
// Inputs:  user_sys_id (String)
// Outputs: found (True/False), email (String), error (String)
(function execute(inputs, outputs) {
  outputs.found = false;
  outputs.email = '';
  outputs.error = '';

  if (!inputs.user_sys_id) {
    outputs.error = 'No user provided';
    return;
  }

  var user = new GlideRecord('sys_user');
  if (!user.get(inputs.user_sys_id)) {
    outputs.error = 'User not found';
    return;
  }

  outputs.found = true;
  outputs.email = user.getValue('email') || '';
})(inputs, outputs);

How it works

  • Every output gets a value up front, so later flow steps never see undefined data.
  • Failures go into an error output the flow can check with an If step, instead of throwing.

Gotchas

  • Map the step’s outputs to the action’s outputs, or the flow won’t see them.
  • Keep actions single-purpose; they’re easier to test and reuse, including as tools for AI agents.

MIT licence. Provided as-is, without warranty. Test in a sub-production instance first.