Is it possible to connect two existing tickets when an event happens?

Originally asked by angel on 13 January 2022 (original question)


Hi!

I have been investigating but have not be able to determine if the following requirement is possible:

I need to connect two projects of the same Jira Server instance.

Suppose we have two projects: A and B. In certain point of the lifetime of the project A, the user can create a linked issue of the project B.

When the user creates that linked issue of the project B from the issue of the project A, those two issues should be connected, so they sync their statuses and comments.

Until now, I have read in the docs that two issues can be manually connected using the connect button in the “more” menu of one of the issues, but I need this connection to happen automatically when the liked issue is created.

Any advices on how to tackle this requirement?

Thank you in advance.


Answer by K. Brasch (DEMICON) on 13 January 2022

Hi angel ,

generally speaking: yes it is possible to connect existing issue. When that should be happening can be defined by the trigger for the synchronisation and then for a scripted connection you can define the id or rather script how to get the id and use that to link existing issues via their ID. So you need to “know” or get somehow the ID of the existing issue you wan to sync with. and then you can create a trigger like if a certain issue type is created in project B, and then define with which issue id it should be synced in the incoming sync script, something like this:

if (firstSync){
   issue.id =  IdToBeSynced //beforehand get the ID and store it in the variable IdToBeSynced
}

Just did that in a project, but it involved some groovy scripting and is highly customized so depends how exactly you want to link the existing issues and when, based on which criteria… Exalate Support told me that you may also use the issue tracker’s API to get that id automatically, community should hold at least 2 examples of that - one for Jira on-prem, another for Jira Cloud.
Maybe this answer already helps you to dig deeper :wink:
Good luck and best wishes!