Preserve issue links between projects

Originally asked by Marie Lennerhagen on 08 April 2020 (original question)


We are using Exalate as a means to migrate Jira projects from one instance to another. When issues within a project are linked all the links will be transferred just fine. But if an issue is linked to an issue in another project then the link is ignored. This happens whether the other project already has been replicated to the new instance or not. Is there a way to preserve links between issues in different projects? If so, how do we do it?Source: Use case - Migration (old community)


Answer by Yaakov Shamii on 23 April 2020

Hi,

Are projects A-AA and B-BB synced with the same connection? otherwise the link won’t be preserved as far as I know.

Regarding your question:

case 1 - issue AA-1 won’t be linked at all.

case 2- if you’re using the same connection AA-1 and BB-1 should be linked.


Comments:

Marie Lennerhagen commented on 23 April 2020

Hi,

Do you have any example code of how to sync two projects using the same connection? I want to sync all issues in project A to project AA and all issues in project B to project BB.

Thank you!

Yaakov Shamii commented on 23 April 2020

Hi,

I’d do something like that:

in the first sync:

    if(replica.projectKey == "AAA"){
        issue.projectKey = "AAA"
    } else if(replica.projectKey == "BBB"){
        issue.projectKey = "BBB"
    }

and if you need different fields for the different projects you can still check what is the replica.projectKey do determine. Also you need to remember to add both project to your jql in the trigger.

Hope that helps.

Marie Lennerhagen commented on 23 April 2020

Great! I’ll try this. Thanks a lot!

Answer by Francis Martens (Exalate) on 08 April 2020

Links will preserved if you

a) have both issues (which link together) are available on the target instance

b) you use following configuration

Hope this helps


Comments:

Marie Lennerhagen commented on 08 April 2020

That’s how we do it and it works well for issues that belong to the same project. My question is if there a way to get this to work for issues belonging to different projects? Example:

Issue A-1 in project A is linked to issue B-1 in project B. Project A is synced with project AA on the other instance. Project B is synced with project BB. As a result, I expect to see a link between issue AA-1 and BB-1 but this doesn’t happen. Instead the link is ignored. Only links between issues in the same project are preserved.

Any input is highly appreciated! Thank you!

Francis Martens (Exalate) commented on 09 April 2020

Hmm - this should work also.

  • Are there any permission problems
  • Can you enable debug logging on the exalate and retest the use case to see if errors are being generated?
Marie Lennerhagen commented on 14 April 2020

I can’t get it to work and there is nothing in the logs indicating that something is wrong. I do get an entry in the Work log and in the History of the issues indicating a change to a link but the actual link is not created.

How is it supposed to work? If you could elaborate on what is supposed to happen in the following cases it would be great:

Case 1
On the first instance I have project A and B. On the second instance I have project AA which is a sync of project A.
I create a link between issue A-1 and B-1 on the first instance. What is supposed to happen in issue AA-1 then? Is there supposed to be a link from issue AA-1 in the
second instance to issue B-1 in the first instance?

Case 2
On the first instance I have project A and B. On the second instance I have project AA which is a sync of project A and project BB which is a sync of project B.
I create a link between issue A-1 and B-1 on the first instance. What is supposed to happen in issue AA-1 and BB-1? Is there supposed to be a link between AA-1 and BB-1 in the second instance (just as there is a link between A-1 and B-1 on the first instance)?

Many thanks!