On this page

What are Jira expressions?

Jira expressions look and feel like regular parser expressions provided by JWT for Jira Cloud but are based on domain-specific language designed and provided by Atlassian with Jira in mind, evaluated on the Jira Cloud side.

They can be used to evaluate custom code in the context of Jira entities. Jira expressions follow JavaScript syntax and can be thought as a JavaScript dialect. See the introduction section from the official documentation here


(warning)JWT for Jira Cloud only uses the features provided by Atlassian which cannot be modified by JWT for Jira Cloud!



Where are Jira expressions used in JWT for Jira Cloud?

JWT for Jira Cloud supports the usage of Jira expressions within its Jira expression condition and Jira expression validator

In order to illustrate with a simple example, the following Jira expression would ensure that an issue is currently assigned to a Jira user.

issue.assignee != null



What is the difference to parser expressions?

While they might look quite same, it is important to know that Jira expressions and the JWT for Jira Cloud parser expressions have nothing in common in the background.

The parser expression equivalent to our former example would read:

%{issue.assignee} != null

Apparently, one of the main differences to Jira expressions is the way fields are referenced: in parser expressions, field values can be referenced by a slightly different set of field codes that are always led by a percentage sign, written between curly brackets, e.g. %{issue.description}

Rule of thumb!

If you spot %{...} the syntax refers to parser expressions- otherwise you are dealing with Jira expressions.



Why do I need both?

Right now, Jira expressions are the only officially supported way to formulate custom conditions or validators in Jira Cloud.

Being the "brain" of Jira Workflow Toolbox for Server and Data Center, its expression parser has evolved from a small set of handy functions to a comprehensive list and a fundamental part of this app over the years.

Therefore it was only obvious to make this core functionality available for Jira Cloud as well.

As in the Server and Data Center version, it is widely used, e.g. to compose texts using field codes or to extend post functions by conditional executions using logical expressions.



Where do I start?

To ensure that you have a quick and easy entry into the world of Jira expressions, we have prepared a comprehensive list of use cases and Jira expression examples.

To deep-dive into Jira expressions we suggest reading up on the additional information we have prepared for you:



What else should I know?

Jira expressions follow certain constraints with regard to the evaluation of those expressions (see the official documentation).

While the limits should be high enough not to interfere with any intended usage, it's important to realize that they do exist:

  • Expression length is limited to 1,000 characters or 100 syntactic elements.
  • Expressions don't support logging or custom error messages. Any non-boolean value will be considered as false 
  • Expression can execute a maximum of 10 so-called "expensive" operations, i.e. those that load additional data, such as entity properties, comments, or custom fields, e.g.
    Given an expression to check whether every sub-task has at least one comment containing an issue key, will fail if this issue has more than 10 sub-tasks.

Expression
issue.subtasks.every(sub => sub.comments.some(com => com.body.plainText.match('([A-Z][A-Z0-9]+)-\d+') != null))
Error message



Need additional resources?

The best way would be to start with the official documentation:

  • No labels