Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Further to: Solved: Jira Automation get count of issues with current i... (atlassian.com)
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:
otherclause
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:
{{#triggerissue.labels}}
((labels in ({{triggerissue.labels}}) OR
{{/triggerissue.labels}}
otherclause
More examples on
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... (atlassian.com)
.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And it's the same if I used issue.labels instead:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register Now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.