JQL query with lookup and smart value in automation

Tim Thompson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 23, 2025

In a Jira automation, I cannot get a JQL query to work with lookup and a smart value. The smart value itself ({{comment.body.match("([A-Z]+-\d+)").first}}) works fine i.e. it looks correct when printed to a comment in the same Jira automation flow, but it returns 0 results when used in a lookup (according to the audit log of the automation). I can confirm that when used in a comment, the value of the smart value is correct, so unsure why it cannot be used in a lookup? I've also tried setting it to a dedicated var as a step in between but that didn't work either. Thanks!

image (19).pngimage (20).png

2 answers

1 vote
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.
January 23, 2025

Hi, Tim -- Welcome to the Atlassian Community!

For a question like this, context is important for the community to help.  Please post the following:

  • an image of your complete automation rule in one single image
  • an image of the full audit log details showing the rule execution

Until we see those...

Some rule actions can have order-of-evaluation / timing problems when evaluating smart value expressions.  The Send Web Request action definitely has this problem, and perhaps the JQL for Lookup Issues does also.

The way to check if this is the cause (and to solve it) is to first store the result of that expression using the Create Variable action. Then use that created variable in both your Log and the Lookup Issues action.

Kind regards,
Bill

0 votes
Saurabh Kapoor
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 31, 2025

Hello Tim, 

My Name is Saurabh Kapoor one of the Support Engineers here, and I will be happy to help you on this issue.

Thank you for reaching out to the Atlassian Community. I understand you're experiencing an issue with using a smart value in a JQL query within Jira automation. It's great to hear that the smart value works correctly when printed to a comment, but I can see how it would be frustrating for it not to work in a lookup.

Based on the information available, it seems that the issue might be related to the pattern used in your smart value. The solution provided in the Atlassian content suggests modifying the regular expression pattern slightly. Here's what you can try:

Solution:

  • Modify the Smart Value Pattern: Instead of using {{comment.body.match("([A-Z]+-\d+)").first}}, try using {{comment.body.match("([A-Z0-9]+-\d+)").first}}. This pattern includes numbers in the project key part of the issue key, which might be necessary for your specific use case.

This adjustment should help the smart value work correctly in the lookup context as well. If the issue persists, ensure that the smart value is correctly set and that there are no additional constraints in your JQL query that might be affecting the results.

I hope this helps resolve your issue. If you have any further questions or need additional assistance, feel free to reach out. We're here to help!

Suggest an answer

Log in or Sign up to answer