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:
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!
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:
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
Thanks for the confirmation and workaround Bill!
Much appreciated,
Phil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
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.