# How do I retrieve remote issue keys for existing already synced issues?

**URL:** <https://community.exalate.com/t/how-do-i-retrieve-remote-issue-keys-for-existing-already-synced-issues/4911>\
**Category:** General Questions\
**Tags:** onpremise-jira, exalate, jira-server, migrated\_question, remote-issue-key\
**Created:** [November 4, 2024, 7:31am UTC](https://community.exalate.com/t/how-do-i-retrieve-remote-issue-keys-for-existing-already-synced-issues/4911 "2024-11-04T07:31:28Z")\
**Posts on this page:** 2\
**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, 7:31am UTC](https://community.exalate.com/t/how-do-i-retrieve-remote-issue-keys-for-existing-already-synced-issues/4911/1 "2024-11-04T07:31:28Z")

</div>

_Originally asked by Marianne Lee on 22 October 2021 [(original question)](https://oldcommunity.exalate.com/questions/37554338)_

* * *

Hi,

I’ve gone through the KB articles [How to update a local custom field with the remote issue key](https://docs.idalko.com/exalate/display/ED/How+to+update+a+local+custom+field+with+the+remote+issue+key). However this is done during the synchronisation process and works only for the 1st sync (new issues). This does not work for issues already synced even though I did a bulk exalate.

```auto
if(firstSync){
syncHelper.syncBackAfterProcessing()
}

```

If I were to unexalate followed by connect, the remote issue key field will be updated but this will create duplicates in attachments and comments, hence I would not choose this option.

Is there another way to retrieve the remote issue key for existing / old issues? Eg. ability to fetch the remote issue key preferably in JQL, or using REST API or through groovy script (e.g. ScriptRuner) ?

We need to display the remote issue key in JQL search results for export and reporting purposes.

I hope there is a workaround for this, as it will be very useful.

Thanks!

* * *

---

<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, 7:31am UTC](https://community.exalate.com/t/how-do-i-retrieve-remote-issue-keys-for-existing-already-synced-issues/4911/2 "2024-11-04T07:31:30Z")

</div>

_Answer by Maximillian Thomas Nadolny on 22 October 2021_

Hi Hi don’t know if I understood your question correctly, and I’m also a user but in general you can assign the remote issue key as follows.

Outgoing on the remote side (but this is in the standard script if not changed)

replica.key = issue.key

Incoming you can just do this

issue.“YourCustomField” = replica.key (for simple custom field → String)

there also is the option to do

issue.customFields.“YourCustomField” = replica.key (but doesn’t sound like you need that)

This will be executed with each sync but only be applied if there is a change if I understand correctly

If you are then using the custom field to do something else it shouldn’t be affected since there is no change

Cheers

Max

* * *

#### Comments:

> **Marianne Lee commented on 25 October 2021**
>
> > Hi Max,
> 
> Thanks for your suggestion, and you’re right in that the issue.customFields.“YourCustomField” will be updated with replica.key with each sync, i.e. with each change.
> 
> This solves part of the problem. The other part getting the remote issue keys for completed/old issues which no longer get new changes. I do not want to initiate an update (add a comment, etc.) as that would modify the issue update date, which then would not be reflected correctly.
> 
> Any ideas on how to tackle that?
> 
> Thanks,
> 
> Marianne

> **Francis Martens (Exalate) commented on 26 October 2021**
>
> > Hi Marianne Lee, Maximillian Thomas Nadolny
> 
> You are both on the right track.
> 
> The bulk exalate will only message the twins whenever the replica is changed.  
> If the replica is the same since previous message, nothing will happen.
> 
> By adding something like
> 
> ```auto
> replica.foo = new Date()
> 
> ```
> 
> To the outgoing sync, a message will also be sent.
> 
> Knowing this you can
> 
> - Adapt the outgoing sync
> - Perform a bulk exalate on all previously synced issues (ie by using a JQL which covers everything)
> - Remove the foo statement from the outgoing sync
> 
> Also note that if you have the connection JiraA to JIraB, and you want to have the JiraB key on the JiraA issues, you will need to adapt the outgoing sync on JiraB and run the bulk exalate on JiraB.
> 
> Give it a try and let us know

> **Kiet Ngo commented on 29 October 2021**
>
> > Hi Francis Martens (Exalate) ,
> 
> Thanks for your response.
> 
> I have the same issue with Marianne Lee , was following this thread. I want to perform bulk exalate changes but don’t know how to get the csv file input here. I have few thousands of issues. What is the best way to do it?
> 
> ![](https://dub1.discourse-cdn.com/flex018/download/thumbnails/37554338/image2021-10-29_16-18-52.png?version=1&modificationDate=1635495533548&api=v2)

> **Francis Martens (Exalate) commented on 29 October 2021**
>
> > The screenshot you provided is of the ‘Bulk Connect’, which is a different feature than the Bulk Exalate
> 
> Check [Bulk Exalate](https://docs.idalko.com/exalate/display/ED/Bulk+Exalate) for more details
