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

**URL:** <https://community.exalate.com/t/how-to-sync-multiple-jira-project-on-local-instance-to-jira-project-in-remote-instance-with-many-to-one-mapping-of-issues/4226>\
**Category:** General Questions\
**Tags:** onpremise-jira, migrated\_question\
**Created:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/how-to-sync-multiple-jira-project-on-local-instance-to-jira-project-in-remote-instance-with-many-to-one-mapping-of-issues/4226 "2024-11-04T06:40:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/how-to-sync-multiple-jira-project-on-local-instance-to-jira-project-in-remote-instance-with-many-to-one-mapping-of-issues/4226/1 "2024-11-04T06:40:07Z")

</div>

_Originally asked by Sai Thakur on 14 May 2020 [(original question)](https://oldcommunity.exalate.com/questions/11339477)_

* * *

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](http://community.exalate.com/pages/viewpage.action?pageId=3703137)

* * *

#### 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](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.

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/how-to-sync-multiple-jira-project-on-local-instance-to-jira-project-in-remote-instance-with-many-to-one-mapping-of-issues/4226/2 "2024-11-04T06:40:08Z")

</div>

_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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 6, 2024, 6:40am UTC](https://community.exalate.com/t/how-to-sync-multiple-jira-project-on-local-instance-to-jira-project-in-remote-instance-with-many-to-one-mapping-of-issues/4226/3 "2024-11-06T06:40:25Z")

</div>

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