Validator

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:

Prerequisite #

Ensure you have the Extensions for Jira Workflow app installed. Follow the installation and setup guide.

Create Custom Validator #

  1. Navigate to the desired Jira Workflow transition.
  2. Click on “Validators” to add a custom validation.

add-custom-validation.jpg

Write your custom validation in the text field and click “Add”.

define-custom-validation.jpg

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, or null. 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 #

  1. Check if the issue is assigned to the current user issue.assignee == user
  2. Verify if the issue is in the “In Progress” status issue.status.name == "In Progress"
  3. Confirm the issue has a due date set !!issue.dueDate
  4. Check if the user is a member of the “Developers” group user.groups.includes("Developers")
  5. Ensure the issue type is “Bug” issue.issueType.name == "Bug"
  6. Verify that the priority is set to “High” issue.priority.name == "High"
  7. Confirm that the current user has the “Developer” permission user.permissions.global.includes("Developer")
  8. Check if the issue has any linked sub-tasks issue.subtasks.length > 0
  9. Ensure that the user is the project lead user == project.lead
  10. 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.