Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel

On this page

Table of Contents
maxLevel3
exclude(On this page).*
stylecircle
typeflat
separatorpipe

General Information

Throughout the documentation we refer to data types that can be used in Jira expression. The most commonly use data types are listed below. Apart from this list, learn more about data types in Jira expressions in the general documentation.


Data typeDescriptionExample

Status
subtletrue
titlenumber

This type represents numeric values.

1, 1.1, -1.1, .1, -.1

Status
subtletrue
titlenumber list

This type represents a collection of numeric values. The size may vary from 0 to any number of numeric values. It is used to read the value of a numeric field in a selection of issues. You can also use literals like  [1, 2, 3] .[1, 2, 3]

Status
subtletrue
titlestringtext

This type represents any kind of text or character string including all kinds of select and multi-select fields.

"Hello world"

Status
subtletrue
titlestring text list
 

This type represents a collection of textstring values. The size may vary from 0 to any number of string values. It is also used to read the value of a string field in a selection of issues. You can also use literals like  ["string_A", "string_B", "string_C"] .["string_A", "string_B", "string_C"]

Status
subtletrue
titleBoolean

A logical, or boolean, value of true or false.true

Anchor
numbers
numbers

Numbers

Status
subtletrue
titlenumber

All numbers in Jira expressions are double-precision 64-bit IEEE 754 floating points. The usual set of mathematical operations is available.

Strings can be converted to numbers with the Number function. For example:

Code Block
Number('1') + Number('2') == 3

(warning) Note that if a string cannot be parsed as number, the function returns NaN (Not a Number).


Anchor
strings
strings

Strings 

Texts 

Status
subtletrue
titlestring

Strings Texts are based on the JavaScript String object.

Currently supported properties and functions are:

FunctionOutputReturned value
length

Status
subtletrue
titlenumber

The string text length
trim()

Status
subtletrue
titlestring

Removes whitespaces from beginning and end
toLowerCase()

Status
subtletrue
titlestring

Returns the same string with all characters in lowercase
toUpperCase()

Status
subtletrue
titlestring

Returns the same string with all characters in uppercase
split(string?)

Status
subtletrue
titlestring list

Splits the string with the given separator
replace(string, string|string => string)

Status
subtletrue
titlestring

Replaces all occurrences of the first argument with the second argument, which can also be a function that accepts the matched part
match(string)

Status
subtletrue
titlestring list

Finds all matches of the given regular expression in this string
includes(string)

Status
subtletrue
titleboolean

Returns true if this string contains the given string, false otherwise

indexOf(string)

Status
subtletrue
titlenumber

Returns the index of the first occurrence of the given string in this string, or -1
slice(number, number?)

Status
subtletrue
titlestring

Returns a substring of this string, according to the given arguments

Rich text

This object represents fields with rich text formatting. Currently it allows to retrieve only plain text, but in the future it will also contain Atlassian Document Format.

  • plainText : The plain text stored in the field (
    Status
    subtletrue
    titlestringtext
    ).

To access such a property you can easily call it by using an expression like:

  • issue.description.plainText


Anchor
dates
dates

Dates 

Status
subtletrue
titledate

This object is based on the JavaScript Date API.

Read more about dates and times in Jira expressions in the general documentation.

Jira expressions provide these additional functions:

FunctionOutputReturned value
toString()

Status
subtletrue
titlestring

Returns a string in the human-readable format, according to the current user's locale and timezone
toCalendarDate()

Status
subtletrue
titleCalendar date

Transforms this into a calendar date, according to the current user's locale and timezone
toCalendarDateUTC()

Status
subtletrue
titleCalendar date

Transforms this into a calendar date in the UTC timezone
plusMonths(number)

Status
subtletrue
titledate

Returns a date with the given number of months added
minusMonths(number)

Status
subtletrue
titledate

Returns a date with the given number of months removed
plusDays(number)

Status
subtletrue
titledate

Returns a date with the given number of days added
minusDays(number)

Status
subtletrue
titledate

Returns a date with the given number of days removed
plusHours(number)

Status
subtletrue
titledate

Returns a date with the given number of hours added
minusHours(number)

Status
subtletrue
titledate

Returns a date with the given number of hours removed

plusMinutes(number)

Status
subtletrue
titledate

Returns a date with the given number of minutes added
minusMinutes(number)

Status
subtletrue
titledate

Returns a date with the given number of minutes removed


Constructors

  • new Date(): Creates a date that represents the current time.
  • new Date(number): Creates a date based on a number of milliseconds that elapsed since the Unix epoch.
  • new Date(string): Creates a date based on a string in the ISO 8601 format (for example, 2008-09-15T15:53:00+05:00). The current user's timezone is used if none is included in the string.


Anchor
calendardate
calendardate

Calendar Date 

Status
subtletrue
titleCalendar date

A time-zone agnostic Date with the same set of methods, but limited only to year, month, and day.

Constructors

  • new CalendarDate(string): Creates a calendar date based on a string in the yyyy-MM-dd format. For example, 2018-09-15.


Anchor
lists
lists

Lists 

Status
subtletrue
titlestring list
 
Status
subtletrue
titlenumber list

Lists are a basic building block of Jira expressions. By design, the language does not support imperative constructs, so instead of writing loops, you need to employ the functional style of processing lists with lambda functions.

For example, to return the number of comments with contents longer than 100 characters:

  1. first map the comments to their texts
  2. then filter them to leave only those long enough
  3. and finally get the length of the resulting list:


Code Block
issue.comments                              
     .map(c => c.body.plainText)         
     .filter(text => text.length > 100)  
     .length


You can access individual elements of a list by using an index, e.g. issue.attachments[0].author.displayName returns the name of the author of the issue's first attachment.


The following properties and functions are available for lists:

FunctionOutputReturned value
length

Status
subtletrue
titlenumber

Returns the number of items stored in the list
map(Any => Any)

Status
subtletrue
titlestring list

Maps all items in the list to the result of the provided function
sort((Any, Any) => Number)

Status
subtletrue
titlestring list

Returns the list sorted by the natural ordering of elements or by the optional comparison function

filter(Any => Boolean)

Status
subtletrue
titlestring list

Leaves only items that do satisfy the given function, that is, for which the given function returns true
every(Any => Boolean)

Status
subtletrue
titleboolean

Checks if all elements in the list satisfy the given predicate
some(Any => Boolean)

Status
subtletrue
titleboolean

Checks if the list contains at least one element that satisfies the given predicate
includes(Any)

Status
subtletrue
titleboolean

Checks if the given argument is stored in the list
indexOf(Any)

Status
subtletrue
titlenumber

Returns the index of the first occurrence of the item in the list, or -1
slice(Number, Number?)

Status
subtletrue
titlestring list

Returns a portion of the list, with the index starting from the first argument (inclusive), and ending with the second one (exclusive).

The second argument is optional, if not provided, all remaining elements will be returned. Negative numbers are allowed and mean indexes counted from the end of the list

flatten()

Status
subtletrue
titlestring list

Flattens a multi-dimensional list
flatMap(Any => Any)

Status
subtletrue
titlestring list

Maps all items in the list and flattens the result
reduce(Any => Any, Any?)

Status
subtletrue
titlestring list

Aggregates all elements of the list using the function provided in the first argument.

The operation starts from the first element of the list, unless the initial value is provided in the optional second argument. If the list is empty and no initial value is given, an error will be returned.


Anchor
maps
maps

Maps

Status
subtletrue
titlemap

If the returned property value is a JSON object, it will be converted to a Map.

  • Static or dynamic member access can be used to retrieve values from a map. For example, map.key is the same as map['key'].
  • Values can also be accessed using the get() method. For example, map.get('key').
  • Both of these methods will return null if there is no mapping for the given key.

To create a new map, write new Map(). Object literals are also evaluated to the Map object. For example, { id: issue.id, summary: issue.summary } will evaluate to a map with two keys: id and summary.

Apart from static and computed member access, the following methods are available for maps:

  • get(string): Returns the value mapped to the given key, or null (Any).
  • set(string, Any): Returns a new map that has all entries from the current map, plus the first argument mapped to the second (Map).
  • entries(): Returns a list of all entries in this map, each entry returned as a two-element list of key and value (List<[String, Any]>).

Constructors

  • new Map(): Creates an empty map. Equivalent to {}.

Optional chaining

Accessing properties in a Jira expression may fail, for example, where:

  • the left-hand side of the operation is null. For example, in the expression a.b where the value of a is null.
  • the property does not exist.

In expressions where such strict rules are not desired, use the optional chaining operator ?.. This operator behaves in the same way as regular member access, but with one crucial difference: when accessing the property fails, null is returned.

Examples:

  • issue.properties?.myProperty?.a?.b—this expression returns null if there is no myProperty defined in the issue, or if there is no a.b path in the value of the property.
  • issue?.customfield_10010—this expression returns null if the custom field doesn't exist.

The operator can also be used in combination with computed member access, for example: issue?.[fieldName].

Anchor
boolean
boolean

Boolean 

Status
subtletrue
titleboolean

There are two boolean values: true and false.

The usual set of logical operators, with behavior following the rules of classical boolean algebra, is available:

OperatorExample
conjunctiona && b
disjunction

 a || b

negation!a