Versions Compared

Key

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


UI Text Box
sizemedium
typeinfo
Jira expressions follow technically speaking the JavaScript syntax. The most common information concerning operators is listed below. To learn more about, please refer to the official documentation.



Excerpt

Comparison operators

The operators, their meaning and the applicable data types you can use them with are listed below.

UI Text Box
typetip

A comparison always returns a

Status
subtletrue
titleboolean
value.


UI Expand
titleOverview of all case-sensitive comparison operators


Info

All operators respect the case of the characters.


OperatorMeaningExamples (all examples return true)
== equal to


Code Block
languagebash
linenumberstrue
1==1
true == true
[1, 2, 3] == [1, 2, 3]
["blue", "red", "green"] == ["blue", "red", "green"]


!= not equal to


Code Block
languagebash
linenumberstrue
0 != 1
"HELLO" != "Hello"
true != false
[1, 2, 3] != [1, 3, 2]
["blue", "red", "green"] != ["blue", "green", "red"]


< less than


Code Block
languagebash
linenumberstrue
1 < 2
"abc" < "bbc"
"abc" < "abcd"


> greater than


Code Block
languagebash
linenumberstrue
2 > 1
"bbc" > "abc"
"abcd" > "abc"


<= less than or equal to


Code Block
languagebash
linenumberstrue
3 <= 3


>= greater than or equal to


Code Block
languagebash
linenumberstrue
"Hello world! Hello *" >= "Hello world"



Logical operators

The table below lists an example set of logical operators that can be used for linking logical terms in an expression.

They take logical terms (which return

Status
subtletrue
titleboolean
values) as operands and can thus be built using:

  • a boolean value
  • a comparison
  • a logical term enclosed by brackets ()
  • two logical terms connected with a logical operator, where boolean values and comparisons themselves are logical terms.


UI Expand
titleOverview of all logical operators


Operator

Meaning

Precedence

!logical negation1 (highest)
&&logical conjunction2
||logical disjunction3


UI Text Box
typeinfo

A single logical term can be enclosed by brackets () in order to increase the readability of the expressions or to define a precedence which differs from the given one.




Conditional operator

The conditional operator, ?-operator, is a powerful one to construct conditional expressions.

Code Block
linenumberstrue
<logical_expression> ? <term_1> : <term_2> 
Image Removed




UI Expand
titleExamples of using the conditional operator


ExpressionDescription


Code Block
linenumberstrue
issue.priority.name == "Highest" ? "Please have a look at this issue immediately" : "No stress, come back later"


IF the priority of an issue is Blocker,

THEN this function will return the 

Status
subtletrue
titletext
 "Please have a look at this issue immediately"

ELSE it will return the 

Status
subtletrue
titletext
 "No stress, come back later".


Code Block
linenumberstrue
issue.somefield == "Red" ? "Color" : "No color"}


IF a custom field (e.g. a select list) has a value of Red,

THEN this function will return the text Color

ELSE it will return No color.


Code Block
linenumberstrue
(new Date()).getHours() > 21:00 || (new Date()).getHours() < 7:00 ? "Night" : "Day"


IF the current time is between 21:00 and 7:00

THEN this function will return the 

Status
subtletrue
titletext
 "Night" ,

ELSE it will return the 

Status
subtletrue
titletext
 "Day".