Workflow Building Blocks for Jira
  • About Workflow Building Blocks for Jira
  • Administrator Guide
    • Setup Conditions and Validators
  • Conditions & Validators
    • πŸš€ Ultimate Condition & Validator
    • Linked Issues Condition & Validator
    • Dates Compare Condition & Validator
    • Fields Required Condition & Validator
    • Jira Expression Condition & Validator
  • Writing Jira Expressions
    • Introduction to Jira Expressions
    • Jira expressions library
    • Writing validation messages
  • Testing & Debugging
    • Testing Conditions & Validators
    • Limitiations
  • Support
    • Service Desk
  • Atlassian Marketplace Apps
    • Workflow Building Blocks for Jira
    • Translated Fields for Jira & JSM
    • Field Rules - UI Modifications for Jira
Powered by GitBook
On this page
  • How Ultimate Validator Works
  • Common Use Cases
  • Making a Field Required Only in Certain Cases
  • Handling Rich Text Fields in Jira Expressions
  • Counting Items in Multi-Select Fields
  • Validating Child and Linked Issues
  • Properly Validating Cascading Select Fields
  • Checking if an Issue is in an Active Sprint
  1. Conditions & Validators

πŸš€ Ultimate Condition & Validator

A Smarter Way to Build Jira Validators πŸŽ‰

PreviousSetup Conditions and ValidatorsNextLinked Issues Condition & Validator

Last updated 9 hours ago

We’ve been working on a more flexible way to build conditions using Jira Expressions, and that led to Ultimate Validator. It lets you use most of the power of Jira Expressionsβ€”but without writing code. Instead, you build conditions through a simple UI.

How Ultimate Validator Works

After selecting a sourceβ€”such as a field or the current userβ€”a list of operations appears. Each operator leads to the next until you reach a terminal operator that requires a value. The Jira expression preview is generated in real time, so you always know exactly how your condition worksβ€”no more guesswork.

Here’s what it looks like:

Common Use Cases

Here are some common scenarios where the Ultimate Validator simplifies complex conditions.

Making a Field Required Only in Certain Cases

Jira’s built-in Field Required validator doesn’t allow conditionsβ€”you either require a field for every transition or not at all. But often, you need a field to be required only when certain conditions are met.

With Jira Expressions, this is possible. For example, if you want the Root Cause field to be required only when Resolution is set to Fixed, you could write:

issue.resolution?.name == 'Fixed' ? issue.customfield_10126 != null : true  

Alternatively, you can achieve the same result using the || (OR) operator. In this case, you'd need to invert the condition: allow the transition when the resolution is not 'Fixed', or require the "Root Cause" field otherwise:

issue.resolution?.name != 'Fixed' || issue.customfield_10126 != null  

Ultimate Validator lets you set this up easily through the UI, with no need to write code.

Handling Rich Text Fields in Jira Expressions

If you're concerned about the recent changes in the multi-text field format during Issue Transition, don't worryβ€”the plainTextValue helper automatically handles the different formats for you.

There are a few key points to keep in mind when writing Jira Expressions manually. First, almost every field can be null, so you typically need to check for null before performing operationsβ€”otherwise, you may encounter a Syntax Error during execution.

Counting characters in Short Text fields is straightforward, but Rich Text (Paragraphs) can be tricky. Most rich text fields are stored as ADF (Atlassian Document Format) objects, meaning they need to be converted using new RichText(value) to access the .plainText property. However, some fieldsβ€”like Description or Environmentβ€”are exceptions, as they are already converted when used in expressions.

Ultimate Validator takes care of these complexities, ensuring that your validation works correctly without requiring manual adjustments.

Counting Items in Multi-Select Fields

With the Count operator, you can validate how many items have been added or selected in multi-value fields, such as:

  • The number of attachments on an issue.

  • Whether only one option is selected in a multi-select field.

  • Ensuring a required number of checkboxes are selected.

  • Requiring a minimum number of Versions, Components, or Labels.

Validating Child and Linked Issues

Jira Expressions allow you to check relationships between issues. The key properties are:

  • subtasks β†’ Returns an issue’s sub-tasks.

  • stories β†’ Returns an Epic’s child issues (excluding sub-tasks).

  • childIssues β†’ Returns both child issues and sub-tasks.

You can also test issue links (e.g., β€œblocked by”) and parent issues.

Ensure Time Is Logged on an Issue or Its Sub-Tasks

To prevent issues from progressing without logged work, you may want to require that time is recorded either on the issue itself or one of its sub-tasks.

Ensure Child Issues Are Closed Before Transitioning the Parent

When requiring all child issues to be closed before the parent moves to a completed status, it's best to use status categories rather than individual status names. Jira has three status categories:

Category name
Category key
Category id

To Do

new

2

In Progress

indeterminate

4

Done

done

3

With Ultimate Validator, you don’t need to deal with categories IDs or keysβ€”just pick the right option from the dropdown.

Properly Validating Cascading Select Fields

The built-in Field Required validator only checks if the parent option is selectedβ€”it doesn’t check the child option. This means a transition can still go through even if the child selection is missing, which isn’t always the expected behavior.

Checking if an Issue is in an Active Sprint

You can check various sprint properties in Jira Expressions, such as start date, end date, completion date, and state.

To check if an issue is in the current sprint, validate the sprint state:

  • "active" β†’ Sprint is in progress.

  • "future" β†’ Sprint is planned but not started.

  • "closed" β†’ Sprint has ended.

With Ultimate Validator, you can easily enforce sprint-based conditions without needing custom expressions.

This is a known issue (), but Ultimate Validator provides a child option operator, allowing you to ensure that the child option is always selected.

JSDCLOUD-6199
Validate that every attachment's file name ends with an extension .pdf
Image shows a real-life example of the Ultimate Validator UI, demonstrating how the fluent interface allows testing against attachment properties such as author, file name, MIME type, file size, and creation date.
Image shows a real-life example of the Ultimate Validator UI, demonstrating how, with just a few clicks, you can make a field required conditionally based on selections in other fields.
Image shows a real-life example of the Ultimate Validator UI, demonstrating how it simplifies writing Jira Expressions for Rich Text fields, which may require special handling. No prior knowledge is neededβ€”the code is generated for you.