Skip to content

Workflow Extensions

A workflow extension is a backend script attached to a workflow transition, as a validator or a post-function.

Add one to a transition

  1. In Scripts, create a script of kind Workflow extension and save it.
  2. Edit the workflow, select a transition, and under Rules add:
    • Script Toolkit validator (under Validate details), or
    • Script Toolkit post-function (under Perform actions).
  3. Choose your script in the rule's configuration, click Add, then Update workflow.

Only scripts of kind Workflow extension can be chosen.

Validators

A validator decides whether the transition may happen. Return:

Return Effect
true Allow the transition
false Block it
{ result: false, errorMessage: '…' } Block it and show the message to the user
const res = await requestJira(`/rest/api/3/issue/${input.payload.issue.key}?fields=assignee`)
const { assignee } = (await res.json()).fields
if (!assignee) return { result: false, errorMessage: 'Assign this work item first.' }
return true

A validator that fails or times out allows the transition, so a broken script can never lock a workflow. A disabled or deleted script also allows it. The error is recorded in Logs.

Post-functions

A post-function runs after the transition and can't block it. Its return value is ignored. To change Jira, for example to add a comment or set a field, set the script's Jira access to Read and write; with Read only, writes are refused and the log says why.

What the script receives

Field Value
input.payload.issue { id, key } of the work item
input.payload.transition The statuses it moves from and to

Conditions

Script Toolkit has no scripted conditions: Forge evaluates workflow conditions as a fixed Jira expression, so they can't run a script. Use a validator to block the transition instead.