Going Stellar

Home/Smart values reference

Jira Automation smart value

and, or, not in Jira Automation conditions: examples

and() is true when both conditions are true, or() when at least one is, and not() flips a condition. Use them inside {{#if()}} to build rules such as a note for work items with a due date and labels.

Syntax

{{and(condition1, condition2)}}
{{or(condition1, condition2)}}
{{not(condition)}}

Arguments

ArgumentWhat it isRequired
condition1, condition2Smart values that return true or false, such as comparisons, exists() or equals()yes

Works on

  • Conditions: comparisons, exists(), equals(), isEmpty and similar
  • Returns: true or false

Examples

{{#if(and(issue.comments.size.gt(1),issue.comments.size.lt(5)))}}Moderately active{{/}}

Match a range: more than one and fewer than five comments.

Result:

Moderately active

Run on Jira Cloud on .

{{and(issue.labels.size.gt(0), issue.comments.size.gt(5))}}

Both checks must pass: labels yes, more than five comments no.

Result:

false

Run on Jira Cloud on .

{{or(issue.labels.size.gt(5), issue.comments.size.gt(1))}}

One passing check is enough.

Result:

true

Run on Jira Cloud on .

{{not(issue.labels.isEmpty)}}

Turn an emptiness check around.

Result:

true

Run on Jira Cloud on .

{{#if(or(issue.comments.size.gt(20),issue.labels.size.gt(1)))}}Needs a look{{/}}

Flag a work item that is either heavily discussed or carries several labels.

Result:

Needs a look

Run on Jira Cloud on .

{{#if(and(exists(issue.duedate),not(issue.labels.isEmpty)))}}Due {{issue.duedate.format("dd MMM")}} and labelled{{/}}

Chain three functions and a date format into one message.

Result:

Due 15 Dec and labelled

Run on Jira Cloud on .

Pitfalls

  • The or() doc example compares issue.comments, which is a list, with gt(20). Compare the count instead: issue.comments.size.gt(20).
  • Comparisons on a field that does not exist, such as Votes on a site without that field, print nothing rather than failing, so a condition built on them is silently never true.

Sources

  1. Jira smart values: conditional logic (Atlassian Support)

Markdown version · All smart values