Forums

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

Autolink tickets from a custom field

Gaurav Parab January 27, 2025

In the Jira ticket there is a custom field which allows the user to add links to other reference Jira tickets. They come as clickable links in the custom field. They are not separated by any delimiter. Is there a way to automate linking all of the tickets in the custom field to the trigger ticket. They need to show up as linked issues.

1 answer

0 votes
Ted Nieblas
Contributor
January 27, 2025

Hi @Gaurav Parab

I am not sure I understand. How are the clickable links getting added to the custom field? What kind of custom field is it (short text, text, paragraph, etc.)?

Why not just create them as Linked issues and get rid of the custom field?

Gaurav Parab January 27, 2025

If you copy a ticket url into the custom field which is a text box, it will convert it to a clickable link assuming you set your rendering settings correctly for the text box. The ticket is coming over from Jira Service Desk and also entered by non technical folks. The ticket URLs are copied by them in the text box. That being said, i was able to figure out a solution for this using existing documentation.

This blogpost provides the solution i require. Although the blogpost describes it for the comments section. You can use the same regex for any field.

 

In the link issue action all you need to do is use a smart value {{issue.customfield_xxxxx.match("(PRJ-\d+)")}} for "relates to" and it will link all of tickets which have a key starting with PRJ

Ted Nieblas
Contributor
January 28, 2025

Glad to hear that you found a solution. That solution is pretty nifty but fragile as it will break should you change your project Keys and be difficult to maintain should you want to add additional project keys to the logic.

That being said, if this works for you, it works for you, right? :)

Like Gaurav Parab likes this
Gaurav Parab January 28, 2025

Another update:  I was thinking about the same thing on how to make it less reliant on specific project keys format. Figured out a better regex. This should work for any project keys in the format "ABC-1234". {{issue.customfield_xxxxx.match("([A-Z]+-\\d+)")}} 

Ted Nieblas
Contributor
January 28, 2025

I believe that project keys may also have numbers and the "_" in them.

Gaurav Parab January 28, 2025

You're right that is probably the case in larger companies with variety of project types. This satisfies my use case for now as we currently don't have limited number of project keys and all in the format mentioned. I am sure there is a way to make the regex work for other scenarios too!

Like Ted Nieblas likes this

Suggest an answer

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

Atlassian Community Events