Automation basics
Understand the general concepts and best practices of automation in Atlassian cloud products.
Check out how we use smart values in our Jira automation template library.
The following smart values are available to insert and format numerical values when setting up a rule.
To use a math expression, you need to use {{#=}}:
1
{{#=}}{{issue.Invoice Amount}} * 1.2{{/}}
You can perform numerical operations on (and between) smart values using the following smart values.
Returns the absolute value of a number. For example, the absolute value of -6 is 6. This is useful for finding and returning the difference between two custom fields, for example Projected grown and Actual growth.
Example:
1
Projected growth is off by {{issue.Projected growth.minus(issue.Actual growth).abs}}
Returns a number rounded to the nearest whole number. For example, 1.6 is rounded to 2.
Example:
1
{{issue.timetracking.timeSpentSeconds.divide(3600).round}}
Returns the lower value of a number. For example, 1.9 returns 1.
Example:
1
{{issue.timetracking.timeSpentSeconds.divide(3600).floor}}
Returns the upper value of a number. For example, 1.1 returns 2.
Example:
1
{{issue.timetracking.timeSpentSeconds.divide(3600).ceil}}
Adds or subtracts one numerical smart value with another. For example, you could update the current story point estimate for an issue by adding a point for each subtask.
1
{{issue.Story Points.plus(issue.subtasks.size)}}
Multiplies one numerical smart value with another. For example, you could set the target date of an issue as + 3 days for each story point.
1
{{now.plusBusinessDays(issue.Story Points.multiply(3))}}
Divides one numerical smart value with another. For example, you could find the number of hours per person spent on an issue.
1
We spent {{issue.timetracking.timeSpentSeconds.divide(3600).divide(issue.Request participants.size)}} hours per person on this ticket.
The following smart values are used to compare a numerical smart value with a given number. These values return either true or false, and can be combined with #if to print more helpful text based on the outcome.
Syntax: gt(value)
Takes a numerical smart value, and checks if it is greater than the value given. For example, you can check the number of votes an issue has received, and print the words "Popular issue" if it has more than 100 votes.
1
{{#if(issue.Votes.gt(100))}} Popular issue {{/}}
Syntax: gte(value)
Takes a numerical smart value, and checks if it is greater than the value given. For example, you can check the number of votes an issue has received, and print the words "Popular issue" if it has 100 or more votes.
1
{{#if(issue.Votes.gte(100))}} Popular issue {{/}}
Syntax: eq(value)
Takes a numerical smart value, and checks if it is equal to the value given. For example, you can check that only one person is involved in a ticket, and print a message if this is the case.
1
{{#if(issue.Request Participants.size().eq(1))}} Only one person involved {{/}}
Syntax: lt(value)
Takes a numerical smart value, and checks if it is less than the value given. For example, you can check if a multi-value custom field has fewer than 2 options selected.
1
{{#if(issue.Multi Select custom field.size().lt(2))}} Only one option selected {{/}}
Syntax: lte(value)
Takes a numerical smart value, and checks if it is less than or equal to the value given. For example, you can check if a multi-value custom field has 2 or fewer options selected.
1
{{#if(issue.Multi Select custom field.size().lte(2))}} Too few options selected {{/}}
Formats a number in US locale. For example, 123412345 becomes 123,412,345.
1
{{issue.Invoice Amount.format}}
Formats a number in the given locale. Learn more about numeric print outputs at the Java documentation.
1
{{issue.Invoice Amount.format("###")}}
Formats a number in the given locale. Eg, for "fr_FR", 123412345 becomes 123 412 345. For a list of locales, refer to the Java documentation.
1
{{issue.Invoice Amount.formatWithLocale("fr_FR")}}
Formats a number as a percentage in the US locale. For example, 0.123 became 12%.
1
{{issue.Story Points.asPercentage}}
Formats a number as a percentage in the given locale. For a list of locales, refer to the Java documentation.
1
{{issue.Story Points.asPercentage("fr_FR")}}
Formats a number as a currency in the US locale. For example, 0.123 becomes $0.12.
1
{{issue.Invoice Amount.asCurrency}}
Formats a number as a currency in the given locale. For example, for "fr_FR", 0.123 becomes 0,12€. For a list of locales, refer to the Java documentation.
1
{{issue.Invoice Amount.asCurrency("fr_FR")}}
Operator | Description | Example | Example result |
---|---|---|---|
+ | Additive operator / Unary plus | 1 + 3 | 4 |
- | Subtraction operator / Unary minus | 4 - 3 | 1 |
* | Multiplication operator | 2 * 3 | 6 |
/ | Division operator | 6 / 4 | 1.5 |
% | Remainder operator (Modulo) | 5 % 3 | 2 |
^ | Power Operators | 2 ^ 3 | 8 |
Boolean operators always result in a value of 1 or 0 (zero). Any non-zero value is treated as a true value. Boolean not is implemented by a function.
Operator | Description | Example | Example result |
---|---|---|---|
= | Equals | 2 = 2 | 1 |
== | Equals | 2 == 1 | 0 |
!= | Not equals | 2 != 1 | 1 |
<> | Not equals | 2 <> 2 | 0 |
< | Less than | 1 < 2 | 1 |
<= | Less than or equal to | 1 <= 1 | 1 |
> | Greater than | 1 > 2 | 0 |
>= | Greater than or equal to | 1 >= 2 | 0 |
&& | Boolean and | 1 && 0 | 0 |
|| | Boolean or | 1 || 0 | 1 |
Functions names are case insensitive.
Function | Description |
---|---|
NOT(expression) | Boolean negation, 1 (means true) if the expression is not zero. |
IF(condition,value_if_true,value_if_false) | Returns one value if the condition evaluates to true or the other if it evaluates to false. |
RANDOM() | Produces a random number between 0 and 1. |
MIN(e1,e2, ...) | Returns the smallest of the given expressions. |
MAX(e1,e2, ...) | Returns the biggest of the given expressions. |
ABS(expression) | Returns the absolute (non-negative) value of the expression. |
ROUND(expression,precision) | Rounds a value to a certain number of digits, uses the current rounding mode; helpful with formatting numbers. |
FLOOR(expression) | Rounds the value down to the nearest integer. |
CEILING(expression) | Rounds the value up to the nearest integer. |
LOG(expression) | Returns the natural logarithm (base e) of an expression. |
LOG10(expression) | Returns the common logarithm (base 10) of an expression. |
SQRT(expression) | Returns the square root of an expression. |
SIN(expression) | Returns the trigonometric sine of an angle (in degrees). |
COS(expression) | Returns the trigonometric cosine of an angle (in degrees). |
TAN(expression) | Returns the trigonometric tangents of an angle (in degrees). |
ASIN(expression) | Returns the angle of asin (in degrees). |
ACOS(expression) | Returns the angle of acos (in degrees). |
ATAN(expression) | Returns the angle of atan (in degrees). |
SINH(expression) | Returns the hyperbolic sine of a value. |
COSH(expression) | Returns the hyperbolic cosine of a value. |
TANH(expression) | Returns the hyperbolic tangents of a value. |
RAD(expression) | Converts an angle measured in degrees to an approximately equivalent angle measured in radians. |
DEG(expression) | Converts an angle measured in radians to an approximately equivalent angle measured in degrees. |
Constant | Description |
---|---|
e | The value of e, precise to 70 digits. |
PI | The value of PI, precise to 100 digits. |
TRUE | The value one. |
FALSE | The value zero. |
NULL | The null value. |
Was this helpful?