I use Exalate on Jira Data Center to sync 2 Jira DC instances.
I need to know remote issue id or issue key. I usually do synchronize information form remote, about issue key, but that happens while remote issue is updated and informations are sent to my local Jira. But in my case i need to know remote issue id or key as soon as the connection is created. It is visible in GUI with syncrhonziation Status. But is it possible to somehow get the relation info (local id/key and remote id/key) programmatically?
You can programmatically retrieve the relation between local and remote issues in Jira Data Center using Exalate’s scripting helpers, even if you don’t use the “external issue key” field.
The recommended approach is to use the syncHelper method getLocalIssueKeyFromRemoteId. This method allows you to find the local issue key linked to a remote issue ID. Here’s how it works:
If there’s no local issue linked to the provided remote issue ID, the method will return null.
This method is script-based, so you can use it in ScriptRunner or Exalate’s own scripting environment. For more details and examples, check the official documentation:
Additionally, you can explore the getLocalIssueFromRemoteUrn method if you have the remote URN instead of the ID:
These methods are the most direct way to programmatically map local and remote issues without relying on custom fields or the GUI.
It can be possible via SQL query. Here is the query you can use on your local side:
SELECT LR."ISSUE_URN" AS local_issue, RR."ISSUE_URN" AS remote_issue
FROM "AO_08F1AF_TWIN_TRACE" TT
LEFT JOIN "AO_08F1AF_REPLICA" LR ON TT."LOCAL_REPLICA_ID" = LR."ID"
LEFT JOIN "AO_08F1AF_REPLICA" RR ON TT."REMOTE_REPLICA_ID" = RR."ID"
JOIN "AO_08F1AF_RELATION" R ON TT."RELATION_ID" = R."ID"
WHERE R."NAME" IN ('CONNECTION_NAME');
CONNECTION_NAME will be the name of the connection for which you want to fetch the issue urns.
Please let me know if you have any further questions or concerns.