Display linked issue in comments

Ryan Gill March 11, 2022

I want to leave a comment to inform the reporter of linked issues. 

Something like:

Hello, your issue has been moved to another project's backlog. Please follow all future progress in issue _______. 

Where ________ is an existing linked issue to the current issue where the comment is being left.


I have tried many smart values but am striking out. Please help! :) 

3 answers

1 accepted

1 vote
Answer accepted
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2022

Hi @Ryan Gill ,

to really find a solution that matches exactly your needs please specify your use case in more details and from a functional perspective. 

Best
Stefan

Ryan Gill March 13, 2022

Hello Stefan

Here is my use case: 

I have a Jira Service Management project which is being used to triage issues before sending them to other projects.

There are workflow transitions that contain a post-function that use Jira Misc Workflow Extensions to create a new issue in another project, and link the new issue to the existing service management issue.

Once the transition to the "Send to Project X" status is done, there is a Jira Automation rule set to update the status of the issue in Jira Service Management to be "Sent to another project" (status type: done/green).

I want, via Jira Automation, for a comment to be left on the Jira Service Management issue, where a message informing the reporter of the Jira Service Management issue that their issue has been triaged and transferred to another project, and inform them of the new key of the issue where they can follow future work on their request by a development team.

Thank you for your help!

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 13, 2022

Hi @Ryan Gill 

As far as the linking is already made by the workflow post-function the automation rule only needs to react to trigger of "issue linked". This will also take the source issue into context (which as far as I got it right will be your Service Management issue). The destination issue in this case is the newly created issue (see inward-outward link description). Therefore the following rule should do the expected work (just took the problem/incident linking, that needs to be configured according your requirements/linking types):

image.pngimage.png

Please keep in mind to configure the rule as multi-project or global rule as it is considered to operate in more than 1 projects.

Best
Stefean

Like Ryan Gill likes this
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 17, 2022

Hi @Ryan Gill 

Did the suggested approach work?

Best
Stefan

Ryan Gill March 25, 2022

Hi @Stefan Salzl , this worked perfectly!

I made it a global rule, but added an if condition to make it apply to a single origin project for the time being. Thank you very much. 

Like Stefan Salzl likes this
1 vote
Sam Harding
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2022

Hi @ryan

The other commenters here have left great suggestions which you can explore. One other method is to use the smart value `{{issue.issuelinks}}`. This provides a list of the issue links on an issue you can use in smart values. For example, the smart value

`{{#issue.issuelinks}}{{type.name}} - {{inwardIssue.key}}{{/}}`

Will print out:

<issue type> - <issue key>

for each link on your issue. In your case, you may want to filter the issue links down to just the one which is type of "Moved to" or whatever the name is of the link. In that case, you could use smart value

{{#issue.issuelinks}}{{if(equals(type.name, "Moved to"), inwardIssue.key)}}{{/}}

This will filter down the issue links to just the issue key of the linked issue, just replace the "Moved to" to the name of the link type. Depending on how the link was created, you may need to replace the inwardIssue to outwardIssue, if you are seeing the wrong issue key being displayed.

Hope that works for you!

Cheers,
Sam

Ryan Gill March 25, 2022

Hi Sam, I got Stefan's suggested approach working nicely, I will keep this in mind for future iterations 

Thank you for your response!

agallaway October 7, 2022

I used Sam's method for an automation when we add a link to an issue in a duplicate situation.  For our use case if issue A and B are duplicates and issue B has a link added to issue A with link type "duplicates"  the automation adds a comment on issue B informing the user that it's a duplicate of issue A.  This was the smart value code I used and it worked great.  Thanks, @Sam Harding for pointing this out.  I had not seen details about this smart value in the documentation.

{{#issue.issuelinks}}
Key: {{outwardIssue.key}}
Reporter: {{outwardIssue.reporter.displayName}}
Summary: {{outwardIssue.summary}}
Description: {{outwardIssue.description}}
{{/}}

0 votes
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2022

Hi @Ryan Gill - First, be sure to consider that if your linked issues are on another project, you'll need to expand the rule scope to include those projects.  Here's how I'd handle it:

Perform a Lookup Issues action with the following query:

Issue IN (linkedIssues({{issue}}))

Then use {{lookupIssues}} in your comment.

Suggest an answer

Log in or Sign up to answer