Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Link issue when mentioned in the description field

Rachel Godina April 1, 2024

Hello! I have been trying to create an automation that links issues when they are mentioned in the description field, and I'm having some trouble. I followed the steps taken from this previously asked question, but have been unsuccessful. I have an automation that works for linking tickets that are mentioned in the comments but even with changing the JQL to access the issue description body, the mentioned tickets don't link. I'm not sure if the issue is the trigger, but I would want it to check every time the issue description is updated.

Automation that I have currently: 

Screenshot 2024-04-01 at 12.36.01 PM.png

I will also include a screenshot of what the automation for linking tickets in the comments looks like (this works perfectly):

Screenshot 2024-04-01 at 12.39.02 PM.png

Any help would be greatly appreciated, thank you!

 

 

1 answer

1 accepted

1 vote
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.
April 1, 2024

Hi @Rachel Godina 

The link issue action only takes one key, and so there could be challenges if:

  • there is no match
  • there are multiple matches
  • the match is to an issue key in another project (and the rule is project-scope)

I recommend writing that match expression on the description to the audit log to observe what it contains.  That will help to diagnose what is happening.

Kind regards,
Bill

Rachel Godina April 1, 2024

Thank you! I just took a look and it seems like the automation is activating, but does not do anything. The problem seems to be with the {{smart value}} condition - specifically the if condition (If: Compare two values). 

Screenshot 2024-04-01 at 1.04.56 PM.png

This is what the ticket looks like (ticket names are not relevant). Test Ticket (blocked) is the ticket that the automation is running on (DS-744).

Screenshot 2024-04-01 at 1.06.15 PM.png

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.
April 1, 2024

Thanks for that information, Rachel.

When I try that match() expression it finds the issue key twice, due to the way the markup works.

The fix for that is to add distinct to return one key per issue:

{{issue.description.match("([A-Z]+-\d+)").distinct}}

Please note: if there are multiple issue references in the Description, the rule would need modifications to advanced branch over the values to add the links.

Rachel Godina April 1, 2024

Thank you! I was able to try it and seem to be getting a similar problem as before:

Screenshot 2024-04-01 at 2.36.35 PM.png

This is the updated automation:

Screenshot 2024-04-01 at 2.36.53 PM.png

Do you believe that I would have to use the distinct parameter in the if condition? 

 

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.
April 1, 2024

First, try writing that expression to the audit log before the condition:

{{issue.description.match("([A-Z]+-\d+)").distinct}}

And...perhaps change to use a smart value condition instead of a :

  • first value: {{issue.description.match("([A-Z]+-\d+)").distinct}}
  • condition: does not equal
  • second value: leave this empty

 

Rachel Godina April 1, 2024

I apologize, I'm not sure what you mean by writing the expression to audit log before the condition, do I use something like the "log action" condition? I have used a smart value condition as well: 

Screenshot 2024-04-01 at 3.02.43 PM.png

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.
April 1, 2024

Yes, that is the one: https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Log-action

It allows writing text, test values, etc. to the audit log for review after the rule runs.  This will show what the smart value expression is parsing into before trying the comparison on it.

Rachel Godina April 2, 2024

Okay, I added two log action conditions with the 

{{issue.description.match("([A-Z]+-\d+)").distinct}}

and it seems to not log anything. I believe only the first log action condition is running which I assume means there is something wrong with the expression since it isn't going through the if condition(?) and nothing is logged. Could be be a problem with the regex?

Screenshot 2024-04-02 at 10.55.30 AM.png Screenshot 2024-04-02 at 10.55.55 AM.png

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.
April 2, 2024

Hmmm...

Without seeing the full details of your description field's markup, I wonder if it contains some newline characters.  The match() function does not handle those well.

Let's try adding to the expression to remove those:

{{issue.description.replace("\n"," ").match("([A-Z]+-\d+)").distinct}}

 

Rachel Godina April 2, 2024 edited

I changed all the expressions to match the one you just made but unfortunately, the audit log responded the same as before. 

Screenshot 2024-04-02 at 11.46.24 AM.png Screenshot 2024-04-02 at 11.46.49 AM.png

Here is exactly what is currently in the issue description for the issue I'm testing. All the text is "normal" type. There are no headings used in the ticket descriptions. Maybe there is an issue with the bold letters, but the link is not in bold so I assume that is not the problem:

Overview

related issue: [link to secondary ticket]

Acceptance Criteria

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.
April 2, 2024 edited

The bold markup should not be it.  One more thing to try...let's write the description directly to the audit log and see what markup it contains:

Description: {{issue.description}}

If smart links are used, this will show it.  If not, it will show what we need to correctly parse the description for the key.

Rachel Godina April 2, 2024

Unfortunately, it seems to be getting nothing from the issue description - I tried it with the "d" in description being capitalized as well (which was how it was in the forum post I mentioned before) but it gave the same result.

Screenshot 2024-04-02 at 12.00.12 PM.png

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.
April 2, 2024

Something is up: that should not be empty!

Your trigger is checking the "Issue Description" field, and not the "Description" field.  Do you have multiple description fields on your issues?

Rachel Godina April 2, 2024

...I checked and on the actual ticket, the description is called "Issue Description", when I look at the options on the trigger, there is both "Issue Description" and "Description". I changed the trigger to be "Description" but nothing happened so it must be the former. Thank you for catching that, I had no idea there was a difference.

I tried changing the audit log condition to:

Description: {{issue.issueDescription}}

but nothing changed (it was still empty) so I believe I will have to figure out what the smart value is named. If you have any ideas of where to look to find that information that would help!

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.
April 2, 2024

You may use this how-to article to identify the smart values, and their structure in the issue:

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Also, I recommend pausing to talk to your Jira Site Admin to learn why there are two fields.  That technique is sometimes used to add template description fields.  If so, there could be other rules or workflow actions happening.

Rachel Godina April 2, 2024

Okay perfect. I do believe there is a template, so I will get confirmation on that. Once everything is clear I will find the new smart value, and then try everything we have tried from the beginning and I will come back if I encounter any issues. Thank you so much for your help!

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.
April 2, 2024

Sounds good...and if...

They used an automation rule (rather than a workflow action) to add the description template, your rule will need adjustments, possibly to allow the first rule's actions to trigger yours.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, team '25, conference, certifications, bootcamps, training experience, anaheim ca,

Want to make the most of Team ‘25?

Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.

Learn more
AUG Leaders

Upcoming Jira Events