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

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Post-function : get and create links between issues on two different jira instances Edited

Hello!

I have an issue A on a JIRA instance A that is linked to an issue B1 on an instance B.
I have an issue B2 on instance B that is linked to issue B1.

With a scripted post-function on a transition of the B2 issue workflow, I would like to automatically link issue B2 to issue A.

With the script I use, I can get the B1 issue id.
But with B1 issue id I can't get A issue id.

Here is the script I am using for development, at this point I am just trying to get the ids of issues B1 and A, and print them in issue B2 summary:

import com.atlassian.jira.component.ComponentAccessor

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def authenticationContext = ComponentAccessor.getJiraAuthenticationContext()

issueLinkManager.getOutwardLinks(issue.getId()).each {
  issueLink ->
    if (issueLink.getIssueLinkType().getName().contains('Tests')) {
        def idReq = issueLink.getDestinationObject()
        issue.summary = 'GRT1 - ' + idReq.getKey() + ' - ' + issue.summary
        issueLinkManager.getOutwardLinks(idReq.getId()).each {
          reqlink ->
            def idBSL = reqlink.getDestinationObject()
            issue.summary = 'GRT2 - ' + idBSL.getKey() + ' - ' + issue.summary
        }
    }
}

 Versions:

  • A JIRA instance = 6.1.2
  • A JIRA instance Script Runner = 3.0.10
  • B JIRA instance = 7.2.6
  • B JIRA instance Script Runner = 4.3.16

Many thanks for your help,

Best regards.

1 answer

Hi,

I believe that you should be able to find the links you are searching for by using the Remote Issue Link Manager utility. This will allow you to interrogate remote links specifically.

getRemoteIssueLinksForIssue(Issue issue) //<- This method will allow you to return remote issue links for a given issue in your local instance.

Note: You can also use this same utility to create links.

Someone else had a similar issue here and resolve the issue using the same method.

I hope this helps!

Steve

Thanks for your answer Stephen,

Best regards.

No Problems!

Did this answer resolve your issue? Are you still having issues with this??

What my friend Stephen really wants is for you to accept his answer so that other users can see that this has been answered :)

Cheers!

Like Erik Macias likes this

Hi Daniel,

I tried using this method to connect two different Jira instances and it hasn't worked at all for me. I'm in 8.4.1, so it looks like this has been deprecated. Do you know if there's a way to do this in 8.4.1?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

Share your Confluence Cloud experience for a chance to win $500!

Take our 5-minute survey to win a $500 Visa gift card! Are you currently using Confluence Cloud? We want to hear from you! Fill out this quick survey about your Confluence Cloud experience so we ...

238 views 5 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you