Workflow Validator Expression Examples
Use these Jira expression examples to block a transition until fix versions, comments, completed subtasks, or linked work item conditions are met.
These examples are specific to the Validate using a Jira expression (ScriptRunner) rule, where the transition button remains visible, but the transition is blocked with an error message until the expression returns true. For more expressions that work for both validators and restrictions, see Workflow Restriction and Validator Expression Examples.
Require a Fix Version when resolving a work item
Ensure that every work item has at least one Fix Version set before it can be transitioned to a Done or Resolved status.
issue.fixVersions.length > 0Require a comment when rejecting or closing a work item
Require users to add a comment when they reject or close a work item, ensuring there is always an audit trail explaining the decision.
issue.comments.some(comment => comment.id == null)Ensure all subtasks are in a Done status before allowing the parent to be closed
Prevent the parent issue from being closed until all of its subtasks are in a Done status, helping maintain workflow consistency and data accuracy.
issue.subtasks.every(subtask => subtask.status.name == 'Done')Control transitions based on linked work items
Restrict transitions unless linked work items meet specific criteria. For example, all blockers are done, or all linked work items have a resolution.
// Check all linked work items are in certain status
issue.links.every(l => l.linkedIssue.status.name == 'Done')
// Check all linked work items of a certain link type are at certain status
issue.links
.filter(l => l.direction == 'inward')
.filter(l => l.type.inward == 'is blocked by')
.every(l => l.linkedIssue.status.name == 'Done')
// Check all linked work items have a resolution
issue.links.every(l => l.linkedIssue.resolution != null)
// Check all linked work items of a certain link type have a resolution
issue.links
.filter(l => l.type.inward == 'is blocked by')
.every(l => l.linkedIssue.resolution != null)