Jira expressions types

This page defines all the types supported in Jira expressions along with their properties and methods.

You can examine the type of any expression at runtime with the typeof operator. For example, typeof issue will return "Issue", which is the name of the type of the issue context variable.

Issue

Constructors
  • new Issue(number): Loads an issue from the database using the given ID.
  • new Issue(string): Loads an issue from the database using the given key.

The constructors return null if the issue doesn't exist or you don't have permission to view it.

Properties
  • id: The issue ID (Number).
  • key: The issue key (String).
  • summary: The issue key (String).
  • parent: The issue parent (Issue).
  • subtasks: The list of subtasks (List<Issue>).
  • description: The issue description (RichText).
  • environment: The value of the environment field (RichText).
  • project: The project the issue belongs to (Project).
  • priority: The priority of this issue (IssuePriority).
  • assignee: The assignee of this issue (User).
  • reporter: The reporter of this issue (User).
  • creator: The user who created this issue (User).
  • issueType: The issue type (IssueType).
  • status: The issue status (IssueStatus).
  • created: The creation time of the issue (Date).
  • updated: The time when the issue was last updated at (Date).
  • dueDate: The time the issue is due (CalendarDate).
  • resolutionDate: The time the issue was resolved at (Date).
  • resolution: The resolution of the issue (Resolution).
  • originalEstimate: The original estimate of how long working on this issue would take, in seconds (Number).
  • remainingEstimate: The estimate of how much longer working on this issue will take, in seconds (Number).
  • timeSpent: The time that was spent working on this issue, in seconds (Number).
  • labels: The list of labels associated with the issue (List<String>).
  • versions: The list of versions the issue affects (List<Version>).
  • fixVersions: The list of versions where the issue was fixed (List<Version>).
  • components: The list of project components the issue belongs to (List<Component>).
  • comments: The list of issue comments (List<Comment>).
  • attachments: The list of issue attachments (List<Attachment>).
  • properties: The properties of the issue (EntityProperties).
  • links: The list of issue links (List<IssueLink>).

Apart from these, all custom fields are available and can be referenced by one of the following:

  • ID: issue.customfield_10010
  • key: issue['com.my.app.field-key']

Custom fields are returned as JSON values, using exactly the same format as in the issue REST API.

Any field that is hidden in the field configuration active for the current issue will be returned as null, regardless of its actual value. Read more about hiding and showing fields in the documentation on the Changing a field configuration page.

Jira Software Fields

If Jira Software is licensed for the current user, the following fields will also be available.

  • epic: The epic the issue belongs to (Issue).
  • isEpic: true if the issue is an epic, false otherwise (Boolean).
  • sprint: The sprint the issue belongs to (Sprint).
  • closedSprints: The list of all past sprints the issue belonged to (List<Sprint>).
  • flagged: true if the issue is flagged, false otherwise (Boolean).

Epics

Epics (issues that have issue.isEpic equal to true or returned by issue.epic) have additional, epic-specific fields. These fields are null for regular issues.

  • name: The epic name (String).
  • done: true if the epic is completed, false otherwise (Boolean).
  • color: The epic color (String: 'color_1', 'color_2', ..., 'color_9').
  • stories: The list of all stories in the epic (List<Issue>).

Project

Constructors
  • new Project(number): Loads a project from the database using the given ID.
  • new Project(string): Loads a project from the database using the given key.

The constructors return null if the project doesn't exist or you don't have permission to view it.

Properties
  • id: The project ID (Number).
  • key: The project key (String).
  • style: The style of the project (String: 'next-gen', 'classic').
  • name: The name of the project (String).
  • projectTypeKey: The key of the project type (String).
  • properties: The properties of the project (EntityProperties).

User

  • accountId: The account ID of the user (String).
  • displayName: The display name of the user (String).
  • properties: The properties of the user (EntityProperties).

IssuePriority

  • id: The priority ID (Number).
  • name: The name of the priority (String).
  • description: The priority description (String).

IssueStatus

StatusCategory

  • id: The category ID (Number).
  • key: The key of the category (String).
  • name: The category name (String).
  • colorName: The color name associated with the category (String).

IssueType

  • id: The ID of the issue type (Number).
  • name: The name of the issue type (String).
  • description: The description of the issue type (String).
  • properties: The issue type properties (EntityProperties).

Resolution

  • id: The ID of the resolution (Number).
  • name: The name of the resolution (String).
  • description: The description of the resolution (String).

Comment

  • id: The ID of the comment (Number).
  • body: (RichText).
  • author: The author of this comment (User).
  • created: The creation time of the comment (Date).
  • updated: The time when the comment was last updated at (Date).
  • properties: The comment properties (EntityProperties).

RichText

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 (String).
  • id: The ID of the issue link (Number).
  • type: (IssueLinkType).
  • direction: Direction of the link, from the point of view of the issue the link was obtained for (String: 'inward', 'outward').
  • outwardIssue: The outward issue of the link (Issue).
  • inwardIssue: The inward issue of the link (Issue).
  • linkedIssue: Issue the issue the link was obtained for is linked to (Issue).

IssueLinkType

  • id: The ID of the issue link type (Number).
  • name: The name of the issue link type (String).
  • inward: The name of the link when it points to the issue (String).
  • outward: The name of the link when it points out of the issue (String).

Version

  • id: The version ID (Number).
  • name: The version name (String).
  • description: The version description (String).
  • archived: true if the version has been archived, false otherwise (Boolean).
  • released: true if the version has been released, false otherwise (Boolean).
  • releaseDate: The release date of the version (CalendarDate).

Component

  • id: The component ID (Number).
  • name: The component name (String).

Attachment

  • id: The attachment ID (Number).
  • author: The user who created the attachment (User).
  • filename: The name of the attachment (String).
  • size: The size of the attachment, in bytes (Number).
  • mimeType: The media type of the attachment (String).
  • created: The attachment creation date (Date).

App

Represents the Connect app that provides or executes the expression.

Sprint

  • id: The sprint ID (Number).
  • state: The state of the sprint (String: 'future', 'active', 'closed').
  • name: The sprint name (String).
  • goal: The sprint goal (String).
  • startDate: When the sprint started (Date).
  • endDate: When the sprint is planned to end (Date).
  • completeDate: The actual date of ending the sprint (Date).
  • properties: The sprint properties (EntityProperties).

Board

  • id: The board ID (Number).
  • hasBacklog: true if this board can have a backlog, false otherwise (Boolean). For example, classic Kanban boards don't have backlogs, and SCRUM boards do.
  • hasSprints: true if this board supports sprints, false otherwise (Boolean). For example, Kanban boards don't have sprints, and SCRUM boards do.
  • activeSprints: The list of all active sprints on this board (List<Sprint>).
  • futureSprints: The list of all planned sprints on this board (List<Sprint>).
  • closedSprints: The list of all completed sprints on this board (List<Sprint>).
  • canAdminister: true if the current user has permissions to administer this board, false otherwise (Boolean).
  • properties: The board properties (EntityProperties).

ServiceDesk

  • id: The service desk ID (Number).
  • project: The Jira project this service desk is based on (Project).

CustomerRequest

CustomerRequestStatus

  • name: The name of this status (String).
  • category: The category of this status (String: 'new', 'indeterminate', 'done', 'undefined').
  • date: The time when this status was set (Date).

CustomerRequestType

  • id: The ID of this request type (Number).

Transition

Type of the transition context variable, available in Jira expressions used to implement workflow conditions and validators. It contains information about the transition that is currently happening and allows to inspect the source and target status.

  • id: The transition ID (Number).
  • name: The transition name (String).
  • from: The current status of the issue (IssueStatus).
  • to: The target status of the transition (IssueStatus).
  • hasScreen: true if there is a screen configured for this transition, false otherwise (Boolean).

EntityProperties

This object can be thought of as a map of all properties, indexed by their keys.

There are a few ways to interact with this map. It is possible to:

  • Get the value of a property using static member access. For example, issue.properties.myProperty.
  • Get the value of a property using computed member access. For example, issue.properties['myProperty'].
  • Get the value of a property using the get() method. For example, issue.properties.get('myProperty').
  • Get a list of keys of all available properties using the keys() method. For example, issue.properties.keys().

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

  • get(string): Returns the property with the given key.
  • keys(): Returns the keys of all properties (List<String>).
  • updated(): Returns the last time any property was updated, or null if there are no properties (Date).
  • updated(string): Returns the last time the property with the given key was updated, or null if the property does not exist (Date).

Accessing a property that is not defined will return null. Properties that are JSON objects are returned as Maps, other values can be returned as List, Boolean, String, or Number, depending on the actual type stored in the property.

Date

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 methods:

  • toString(): Returns a string in the human-readable format, according to the current user's locale and timezone (String).
  • toCalendarDate(): Transforms this into a calendar date, according to the current user's locale and timezone (CalendarDate).
  • toCalendarDateUTC(): Transforms this into a calendar date in the UTC timezone (CalendarDate).
  • plusMonths(number): Returns a date with the given number of months added (Date).
  • minusMonths(number): Returns a date with the given number of months removed (Date).
  • plusDays(number): Returns a date with the given number of days added (Date).
  • minusDays(number): Returns a date with the given number of days removed (Date).
  • plusHours(number): Returns a date with the given number of hours added (Date).
  • minusHours(number): Returns a date with the given number of hours removed (Date).
  • plusMinutes(number): Returns a date with the given number of minutes added (Date).
  • minusMinutes(number): Returns a date with the given number of minutes removed (Date).

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.

CalendarDate

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, 2008-09-15.

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, first map the comments to their texts, then filter them to leave only those long enough, and finally get the length of the resulting list:

1
2
3
4
issue.comments                              
     .map(c => c.body.plainText)         
     .filter(text => text.length > 100)  
     .length                             

The following properties and methods are available for lists:

  • length: Returns the number of items stored in the list (Number).
  • map(Any => Any): Maps all items in the list to the result of the provided function (List).
  • sort((Any, Any) => Number): Returns the list sorted by the natural ordering of elements or by the optional comparison function (List).
  • filter(Any => Boolean): Leaves only items that do satisfy the given function, that is, for which the given function returns true (List).
  • every(Any => Boolean): Checks if all elements in the list satisfy the given predicate (Boolean).
  • some(Any => Boolean): Checks if the list contains at least one element that satisfies the given predicate (Boolean).
  • includes(Any): Checks if the given argument is stored in the list (Boolean).
  • indexOf(Any) Returns the index of the first occurrence of the item in the list, or -1 (Number).
  • slice(Number, Number?): 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 (List).
  • flatten(): Flattens a multi-dimensional list (List).
  • flatMap(Any => Any): Maps all items in the list and flattens the result (List).
  • reduce(Any => Any, Any?): 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.

Map

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 {}.

String

Strings are based on the JavaScript String object.

Currently supported properties and methods are:

  • length: The string length (Number).
  • trim(): Removes whitespaces from beginning and end (String).
  • toLowerCase(): Returns the same string with all characters in lowercase (String).
  • toUpperCase(): Returns the same string with all characters in uppercase (String).
  • split(string?): Splits the string with the given separator (List<String>).
  • replace(string, string|string=>string): Replaces all occurrences of the first argument with the second argument, which can also be a function that accepts the matched part (String).
  • match(string): Finds all matches of the given regular expression in this string (List<String>).
  • includes(string): Returns true if this string contains the given string, false otherwise (Boolean).
  • indexOf(string): Returns the index of the first occurrence of the given string in this string, or -1 (Number).
  • slice(number, number?): Returns a substring of this string, according to the given arguments (String).

Number

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 cast to numbers with the Number function. For example:

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

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

Boolean

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:

  • conjunction (for example, a && b),
  • disjunction (for example, a || b),
  • negation (for example, !a).