Forums

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

Jira Automation - text contains (~) operator not returning expect results

philip_song
Contributor
July 16, 2025

Hi, 

I am trying to use the lookup work items component in Jira Automation to iterate on a result but I can't return the set of results that I am expecting.

My rules are as follows:

Create variable:
-Name: updatedmetrics
-smart value: {{issue.customfield_15855}}

lookup work items:

type IN ("New Metric Task") AND "associated cc tickets[short text]" ~ "{{updatedmetrics}}"

I am also putting this into the log.

This smart value is a comma delimited list (say 123,124,125,126). I have 4 separate tickets where the field 'associated cc tickets' contains either 123, 124,125, or 126.

In the log, it shows that the above jql resolves to the following:

type IN ("New Metric Task") AND "associated cc tickets[short text]" ~ "123,124,125,126"

When I search for this within Jira, the 4 issues show up as expected:

jirasearchresults.png
However the result of the lookup in the automation shows "A search during custom value definition found no work items."

 

If I update one of these fields to be explicitly `123,124,125,126` (instead of one element individually) then the automation rule runs and returns the appropriate ticket. Therefore it seems to me that there's something specific about the contains operator that works in normal Jira search but not in automation. I tried to move this rule logic to be within a for each branch but the result is the same. 

The `IN` operator errors here (maybe not useable for custom fields?) so I'm not sure what else to try. Thanks in advance!

1 answer

1 accepted

3 votes
Answer accepted
Bill Sheboy
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.
July 16, 2025

Hi @philip_song 

Short answer: you have found a defect in the Lookup Work Items action using JQL, and there is a workaround for it.

 

Testing a standalone work item search with that JQL and the CONTAINS ~ operator, I observed:

  • when there are spaces after the commas, no results are found:
    • myField ~ "123, 124"
  • when there are no spaces, an OR is performed to find results for each value:
    • myField ~ "123,124"

Testing either expression with the Lookup Work Items action returns no results.

I checked the public backlog and did not find this defect, and I recommend working with your Jira Site Admin to submit a defect for this symptom here: https://support.atlassian.com/contact/#/

 

Now for the workaround: split the values into a list to create individual checks, joined together with JQL OR operators:

type IN ("New Metric Task")
AND (
{{#updatedmetrics.remove(" ").split(",")}}
"associated cc tickets[short text]" ~ "{{.}}"
{{^last}} OR {{/}}
{{/}}
)

 

Kind regards,
Bill

philip_song
Contributor
July 17, 2025

Thanks for the confirmation and workaround Bill! 

 

Much appreciated,
Phil

Like Bill Sheboy likes this
Bill Sheboy
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.
July 17, 2025

Please let me know if that works for you...and anything you learn from the support team when submitting the ticket.

And if it works, please consider marking this question as "answered" to help others with a similar need find solutions faster.  Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events