1
0
-1

I am looking for a solution how to pair an existing issue in one project with an existing issue in another project.

In the incoming sync, I would like to test two custom field content, which will help me to search for the existing issue in the other project.

I saw a solution posted by Francis Martens (Exalate)  some time ago on Atlassian Community

https://community.atlassian.com/t5/Jira-Service-Management/Backbone-Issue-sync-tool-link-two-existing-issues/qaq-p/1631698

Using his suggestion, I wanted to expand the code he proposed:

if (firstSync) {
   issue.id = <fetch the appropriate target issue id>
}

To sum up, I am looking for a solution where I will be able to sync and connect with the existing remote issue (it will always be only one), when a certain JQL condition is met. In Jira Automation this JQL looks as follows

project = IFC AND issutype = Task AND "IFC_ID" = {{triggerissue.customfield_10100"}}

So in Exalate the sync should be initiated, if the local custom field value is found in the same custom field value in another specific project and issue.

I tried to draft the code but I doubt if it is correct

if (firstSync) {
   issue.projectKey = "IFC"
   issue.typeName = "Task"
//I want to sync only when the remote CustField "IFC_ID" equals the local CustField value
   issue.customFields."IFC_ID".value = replica.customFields."IFC_ID"?.value
}

Can someone direct me how to write this line from Francis Martens (Exalate) ?

issue.id = <fetch the appropriate target issue id>
    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi

      you can do it by using Connect Option in More Menu from original ticket

      you select a connection and indicated a remote ticket ID


      Before , be sure that you  enabled Connect option in exalate settings


      thanks

      1. Bogdan Gorka

        Hello Salma,

        Thank you for your reply.

        The manual solution is only good for occasional find-and-connect events.

        I needed an automatic solution, that will be initiated by the Exalate trigger.

        It turns out that it may be possible using some extended groovy script.

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Hi Bogdan Gorka 

      I don't have the example code at hand immediately, but you should be able to instantiate the Jira search service


      com.atlassian.jira.bc.issue.search.SearchService


      Check out the TriggerSync example which is also launching a JQL search.




      Hope this helps

      1. Bogdan Gorka

        Thank you Francis. That was a good starting point for our developer to work on the solution. The good news is that it possible.

      CommentAdd your comment...