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:
I will also include a screenshot of what the automation for linking tickets in the comments looks like (this works perfectly):
Any help would be greatly appreciated, thank you!
The link issue action only takes one key, and so there could be challenges if:
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
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).
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you! I was able to try it and seem to be getting a similar problem as before:
This is the updated automation:
Do you believe that I would have to use the distinct parameter in the if condition?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 :
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I changed all the expressions to match the one you just made but unfortunately, the audit log responded the same as before.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
...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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.