Workflow condition
Control whether a workflow transition is allowed using a Jira Expression. One per script (singleton).
A Workflow Condition trigger evaluates a Jira Expression every time an issue is about to transition through a specific workflow step. Unlike other triggers, the expression is not executed in the JiBrok sandbox engine - it is sent directly to Jira and evaluated natively as a Jira Expression.
If the expression returns true, the transition is allowed. If it returns false (or any other value), the transition button is hidden from the user.
Note: Workflow Conditions are available in company-managed projects only.
Setup
- Save a script in the Library
- Go to the Config tab - Triggers
- Add Trigger - select Workflow Condition. It is offered whatever engine the script is on; on a JavaScript, Python or Groovy script the dialog warns that the script switches to the Jira Expressions engine
- Write the script as a Jira expression that evaluates to
true(transition shown) orfalse(transition hidden). The source is not converted when the engine switches: save checks it as a Jira expression and refuses it until it is valid - Save the script
- In Jira Administration - Workflows, edit the desired workflow
- Select the transition you want to control
- Add the Run Script - JiBrok Studio condition
- Select the configured script from the dropdown and save the rule
Applying script changes
The expression text is copied into the workflow rule when the rule is saved. After editing the script, open the rule again and save it to apply the new version - until then Jira keeps evaluating the old expression. The trigger’s config screen shows a warning banner when the script was edited after the workflow rule was saved.
Failures and Error Monitor
When Jira cannot evaluate the expression, the transition is simply hidden - the script never runs, so there is no entry in Run History. Jira reports the failure to the app, and it is recorded in Error Monitor under the Workflow Condition trigger type with the messages Jira returned.
The failure is matched to a script by the exact expression text. If the script was edited after the workflow rule was saved, the failure cannot be attributed and is not recorded - re-save the workflow rule to apply the latest version.
Jira Expressions engine
When you add a Workflow Condition trigger, the script engine is automatically switched to Jira Expressions. This is a special engine type that differs from JavaScript, Python, and Groovy:
- The script is a native Jira Expression, not sandbox code
- Jira evaluates the expression directly - JiBrok Studio sandbox limits do not apply (no execution time cap, no API call limits, no loop iteration limits). Standard Jira Expressions limits managed by Jira itself still apply
- All limits and restrictions are managed by Jira itself
- The Jira Expressions engine is exclusive to the Workflow Condition trigger - it cannot be used with other trigger types
- Adding a Workflow Condition trigger removes all other triggers from the script
- The expression uses the standard Jira expression context variables (such as
issueanduser), not the sandbox variables of other triggers; trigger parameters are not used, since no script runs - A script on the Jira Expressions engine can have only this trigger, so Add Trigger offers no other type for it
- The existing source is not converted when the engine switches - rewrite it as a Jira expression before saving
Configuration
| Setting | Description |
|---|---|
description |
Optional description for the condition (up to 2,000 characters). Helps identify the condition in Jira workflow configuration |
Context variables
Jira Expressions have their own context, provided by Jira (not by the JiBrok sandbox):
| Variable | Type | Description |
|---|---|---|
issue |
Issue | The issue being transitioned |
project |
Project | The project the issue belongs to |
user |
User | The user performing the transition |
now() |
DateTime | Current date and time (function call) |
These are standard Jira Expression context variables. For the full list of available properties and methods, see Atlassian Jira Expressions documentation.
Examples
// Allow transition only if the issue has an assignee
issue.assignee != null
// Allow transition only for issues with "High" or "Highest" priority
issue.priority.name in ["High", "Highest"]
// Allow transition only if the current user is the reporter
user.accountId == issue.reporter.accountId
// Allow transition only for issues created more than 1 day ago
now().minusDays(1).isAfter(issue.created)
// Combine multiple conditions
issue.assignee != null && issue.priority.name != "Low" && issue.status.name == "In Review"
Differences from other triggers
| Aspect | Workflow Condition | Other Triggers |
|---|---|---|
| Engine | Jira Expressions (native Jira) | JavaScript / Python / Groovy (sandbox) |
| Execution | Evaluated by Jira | Executed in JiBrok sandbox |
| Engine limits | None (managed by Jira) | Execution time, API calls, loop iterations |
| Sandbox features | None (no log(), requestJira(), API namespaces) |
Full sandbox API |
| Return value | true = allow, anything else = hide transition |
Varies by trigger type |
| Behavior on block | Transition button is hidden | Depends on trigger (error message for validators) |
| Compatible triggers | None (exclusive) | Can combine with other triggers |
See also
- Triggers Overview - All trigger types at a glance
- Workflow Validator - Validate transitions with sandbox scripts
- Workflow Post Function - Run scripts after workflow transitions
- Limits - All execution and storage limits
- Jira Expressions documentation - Atlassian reference
