Skip to main content

Workflow conditions

A Scripted Condition decides whether Jira offers a transition at all. When it's false, Jira hides the transition: people don't see a move they aren't allowed to make.

Applies to: Script Master for Jira Β· Cloud, company-managed and team-managed spaces

A condition is a Jira expression that Jira evaluates. You can build it from checks without writing code, or write the expression yourself. Jira runs it, so a condition works without the Companion App.

A condition must return a boolean​

The expression returnsWhat happens
trueThe transition is available.
falseThe transition is hidden.
A string, a number or any other valueThe transition is hidden. The value isn't shown anywhere.
Nothing, because the expression failedThe transition is hidden.

A condition can't show a message. To block a transition and tell the person why, use a validator.

Variables in a condition​

VariableWhat it holds
userThe person Jira checks the transition for
issueThe work item
projectThe space of the work item
transitionThe transition being checked
workflowThe workflow that holds the condition
configThe rule's saved configuration
groupOperatorHow this condition joins the others on the transition: AND, OR, or null when it's the only one
customerRequest, serviceDeskThe request and its service desk, on Jira Service Management transitions only

A condition has no originalIssue. Only a validator gets it, because only a validator runs after the transition screen is filled in.

When a condition fails to evaluate​

If Jira can't evaluate the expression, it hides the transition. Script Master counts these failures in the Last 7 days column of the Workflows tab.

Examples​

All three examples are also in the editor's Snippets.

Allowed work types​

The transition is visible only for the listed work types.

['Bug', 'Task'].includes(issue.issueType.name)

Comment from the person moving it​

The transition is visible only when the person has commented on the work item.

issue.comments
.filter(c => c.author.accountId == user.accountId)
.length > 0

Stricter when combined with OR​

When this condition is one of several alternatives, it asks for more.

groupOperator == 'OR'
? issue.assignee != null && issue.priority.name == 'Highest'
: issue.assignee != null