Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Exact match search for issue.labels does not work in JIRA data center 9.12.15

Xiaoli January 12, 2025

Hi Experts.

I need the exact match search for labels in JIRA automation using smart value. 

The following expression was used in the adding a comment action and it returns none while my JIRA issue has the label "abc-def".  

              "match abc-def"={{issue.labels.match("abc-def")}}

How should I compose the smart value for labels to accomplish exact match search?

What's the possible reason Why the match function does not work? 

The doc I referenced is https://confluence.atlassian.com/automation0902/jira-smart-values-text-fields-1431247611.html 

Thanks a lot. 

Mary

1 answer

1 accepted

0 votes
Answer accepted
Sahir Maharaj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2025

Hello @Xiaoli

The match() function in Jira automation for labels might not support exact matching as intended in some versions.

Instead, you can use smart value expressions like {{#issue.labels}}{{.}} {{/issue.labels}} to evaluate and compare labels programmatically.

Alternatively, use JQL queries with precise conditions if supported by your setup.

 

Xiaoli January 13, 2025

Thanks a lot. Sahir.

I am using this match search to compose the comments in the commenting on issue action. 

{{#IF(and(equals(issue.labels.join(",").indexOf("abc-def"),-1), equals(issue.labels.join(",").indexOf("cdp-updates"),-1)))}}

Please add the label of .....

{{/}}

But when there's label contains "abc-def" or "cdp-updates" like "abc-def-1" or "cdp-updates-dee", it will passed the IF and get the comment part within it which is not expected. 

Any ideas how I can achieve this in the comment body?

Suggest an answer

Log in or Sign up to answer