Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Nulling an expression's clause when a list count is zero


Further to: Solved: Jira Automation get count of issues with current i... (

How do I make "((labels in ({{triggerissue.labels}}) OR" evaluate to null when labels is an empty list?

I have this expression:

((labels in ({{triggerissue.labels}}) OR otherclause)

If there are any labels I want them to be evaluated, e.g. if triggerIssue.labels is label-1: 

labels in (label-1) or otherclause

But if labels are empty I don't want:

labels in () or otherclause

Because an empty list is invalid

I just want:


Per the spec, 

From GitHub - janl/mustache.js: Minimal templating with {{mustaches}} in JavaScript or Jira smart values - lists | Automation for Jira Data Center and Server 8.0 | Atlassian Documentation I guess:


((labels in ({{triggerissue.labels}}) OR



More examples on

Jira smart values - conditional logic | Automation for Jira Data Center and Server 8.0 | Atlassian Documentation

When I place this into an Audit log statement it works fine, omitting the block when the list of labels is empty. (Orange box)

When I place the same into a Related JQL statement it does not, instead it passes "labels in ()". (Red box)


I believe that Related Issues (For JQL) should be able to take smart values.

Solved: Not able to grep related issues by a simple jql wi... (

1 answer

This does not work:

"Function Type" in ("External System") AND ( {{#triggerissue.labels}} ((labels in ({{triggerissue.labels}}) OR {{/triggerissue.labels}} key in ({{triggerissue.Functions to Onboard}}) ) AND project = FN
Error searching for related issues. This is most likely because the following issues don't have a related issue of the type you specified. Try narrowing your search to only include issues that contain links to related issues:: "(("Function Type" in ("Onboardee To Read") AND (labels in () OR key in (FN-505 )) AND project = FN) AND (key != ON-107 )) AND (project in (10811,13703,15606,14203))" - Error in JQL Query: Expecting either a value, list or function but got ')'. You must surround ')' in quotation marks to use it as a value. (line 1, character 60)

So triggerissues.labels is clearly an empty list, which should have nulled out the rendering block around labels

But GitHub - janl/mustache.js: Minimal templating with {{mustaches}} in JavaScript

says for: 

False Values or Empty Lists
If the person key does not exist, or exists and has a value of null, undefined, false, 0, or NaN, or is an empty string or an empty list, the block will not be rendered.

Accordingly, "labels in () OR" should not have been rendered at all.

And it's the same if I used issue.labels instead:


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

5,058 views 18 32
Read article

Atlassian Community Events