JQL numeric string summary matching

Jordan Wolman April 25, 2023

Hello, 

 

I'd like to set up an automation rule that links a newly created ticket to an existing ticket IF the first 10 digits (numeric) of the summary match those of an existing ticket. I've tried several ways to do this with no success. 

My current rule: 

Trigger: Newly created issue

Then lookup issues: summary ~ "^\\d{10,}"

Then link issues

My JQL query in the lookup issues step is saying "Unable to parse the text '^\d{10,}' for field 'summary'. " but I'm struggling to determine what is wrong. 

1 answer

1 accepted

0 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2023

Hello @Jordan Wolman 

From where did you get the idea that you could use that sort of syntax in a JQL?

This document discusses what is valid to use when searching a text field:

https://support.atlassian.com/jira-software-cloud/docs/search-syntax-for-text-fields/

Jordan Wolman April 26, 2023

Thank you from sharing - I do not see a section in this article that discusses dynamic searches i.e. matching a string by an ID number or name. I'm assuming what I was trying to accomplish is not possible. 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2023

JQL criteria for text fields does not support the use of regex.

You said you are trying to match the first 10 digits from the newly created issue Summary against other issues. Are the digits the first 10 characters in the summary?

If so, then you could use the left() function to pull the first 10 characters.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#left-int-length-

You could then use that in your Lookup with or without (as you deem necessary) the wildcards that are supported for criteria for text fields:

summary ~ "{{issue.description.left(10)}}"

Jordan Wolman April 27, 2023

Hi Trudy - yes the digits are the first 10 characters of the summary. 

I would like for when a new issue is created, the automation rule to search for a match of those first 10 characters and if one is found, link said tickets. I'm having trouble determining what actions/condition steps to create for this though. I tried... 

When: Issue created 
Then: lookup issues using {{issue.summary.left(1)}}
Then: Link issue to trigger issue

 

Do you have a recommendation for how I should create the rule details? 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 27, 2023

Try this

TRIGGER: Issue Created
FOR BRANCH / RELATED ISSUES / JQL
JQL: summary ~ "{{issue.summary.left(10)}}" and issue != {{triggerIssue.key}}
ACTION: Link Issues

You might want to add conditions after your trigger if you want to limit the rule execution based on elements of the created issue (i.e. Type, a setting in another field, etc.)

You might want to also experiment with the Advanced Issue Search screen and searches for a specific set of 10 digits in the Summary field, just to see how the search results turn out. For instance are those 10 digits standalone or part of a longer digit sequence? What if the 10 digits are found elsewhere in the Summary. Seeing how those results turn out might lead you to change the JQL you use in your rule.

Suggest an answer

Log in or Sign up to answer