Validator - Extensions For Jira Workflow #
Overview #
Learn how to add custom validations to Jira Workflow using the Extensions for Jira Workflow app. Read more using Jira expression here:
- Guide: https://developer.atlassian.com/cloud/jira/software/jira-expressions/
- Reference: https://developer.atlassian.com/cloud/jira/software/jira-expressions-type-reference/
Prerequisite #
Ensure you have the Extensions for Jira Workflow app installed. Follow the installation and setup guide.
Create Custom Validator #
- Navigate to the desired Jira Workflow transition.
- Click on “Validators” to add a custom validation.
Write your custom validation in the text field and click “Add”.
For workflow validations, you can use the following objects (context variables):
user
(User): The user the validation is evaluated for.app
(App): The app that provided the validation.issue
(Issue): The issue selected for transition.project
(Project): The project the issue belongs to.transition
(Transition): The transition that the validation is being evaluated against.workflow
(Workflow): The workflow that contains the validation.config
(JSON): The configuration saved on the configuration page using the javascript API.groupOperator
(String): The logical operator for a group the validation belongs to. Possible results are:AND
,OR
, ornull
.null
is returned if the validation is the only validation in the transition.
Additionally, these are available for Jira Service Desk transitions:
- customerRequest (CustomerRequest): The customer request selected for transition.
- serviceDesk (ServiceDesk): The service desk the customer request belongs to.
Examples #
- Check if the issue is assigned to the current user
issue.assignee == user
- Verify if the issue is in the “In Progress” status
issue.status.name == "In Progress"
- Confirm the issue has a due date set
!!issue.dueDate
- Check if the user is a member of the “Developers” group
user.groups.includes("Developers")
- Ensure the issue type is “Bug”
issue.issueType.name == "Bug"
- Verify that the priority is set to “High”
issue.priority.name == "High"
- Confirm that the current user has the “Developer” permission
user.permissions.global.includes("Developer")
- Check if the issue has any linked sub-tasks
issue.subtasks.length > 0
- Ensure that the user is the project lead
user == project.lead
- Verify that the current user is in Service Desk Team role
user.getProjectRoles(issue.project).map(it => it.name).includes("Service Desk Team")
Team-managed project limitations #
In team-managed projects, it is not possible to extend workflows with custom conditions, validators, or post-functions. The predefined set of workflow rules must be used as-is, with no options for customization through plugins or custom development.