How to sync Multiple JIRA project ( on Local Instance) to JIRA project in Remote Instance with Many to One mapping of Issues?

Originally asked by Sai Thakur on 14 May 2020 (original question)


we have one of our requirements to sync issues from multiple JIRA projects on a local instance to a JIRA project in remote instance, wherein issues need to be synced from multiple projects to one project, more like many to one mapping ( some fields from a project and some from another to a project in remote JIRA instance). In hoping to do so, I tried to assign issue key in the incoming sync on the remote so that it updates the issue instead of creating a new one but a new issue was created instead of updating the exiting issue whose key was passed in. Is there a way of achieving this, any suggestion will be super helpful. Thank you

Source: Jira Server/Datacenter


Comments:

Roman commented on 15 May 2020

Hi Sai Thakur ,

Would connect operation be useful in this case? https://docs.idalko.com/exalate/display/ED/Connect+Operation

Sai Thakur commented on 15 May 2020

Thank you for the reply but I am looking for a configuration that can be put in place instead of manual intervention and sync only some selected fields from local issue to remote issue.

Answer by Juan Grases on 15 May 2020

Hi!

Something that is possible with exalate is to automatic connect to a remote issue based on a custom field value representing the remote issue key, in that case, your outgoing script would look like this:

import com.atlassian.jira.component.ComponentAccessor
import com.exalate.api.replication.out.IEventSchedulerService
import com.exalate.api.trigger.ISyncInitiationService

def syncService = ComponentAccessor.getOSGiComponentInstanceOfType(ISyncInitiationService.class)

def ess = ComponentAccessor.getOSGiComponentInstanceOfType(IEventSchedulerService.class)
   
if(firstSync && syncType == "EXALATE"){
  def remoteIssueKey =  issue.customFields."Remote Issue"?.value
  if(remoteIssueKey){
    syncService.connect(
      issue.key, // specify the issue key you want
      remoteIssueKey, // specify the issue key you want
       connection.name, // set the relevant connection name
      ,false, true, true, false
    )
    ess.scheduleSyncEventForConnectedIssue(issueKey, connection)
  }
}else{
    replica.summary = issue.summary
    replica.description = issue.description
    replica.status = issue.status
    replica.attachments = issue.attachments
    replica.key = issue.key
    replica.workLogs = issue.workLogs
}

In this example, when the issue is exalated (this can be automated with a trigger) it will be connected with the remote issue based on a custom field named “Remote Issue”. Would this work for your case?


Comments:

Sai Thakur commented on 16 May 2020

This might work for us, I will implement and let you know. Thank you so much, great help.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.