How do we set the remote issue key in a custom field on the initiating issue?

Originally asked by Samip K Banker on 30 August 2019 (original question)


Once the sync is done… Exalate populates the remote issue key on the side panel… we would like to update the remote issue key (along with the URL) in the custom field of the initiating issue… how do we do that?


Answer by Hung Nguyen on 02 November 2019

Is it just being set using replica.key?

Something like this in the Incoming rule would work, wouldn’t it?

issue.customFields.“Remote Key”.value = replica.key


Answer by Francis Martens (Exalate) on 30 August 2019

This case is described in ExalateEventListener.groovy

It will require an external script to be installed on the server (described here), and then add to your outgoing sync following code

ExalateEventListener.hangListener(connection,{ 
                   String localIssueKey, 
                   String remoteIssueKey, 
                   localIssue, 
                   remoteIssue ->

     localIssue.customFields."Remote Key".value = remoteIssueKey
     })

Comments:

Samip K Banker commented on 03 September 2019

user-50445 :

I created ExalateEventListener.groovy (by copying the data from ExalateEventListener.groovy) under $JIRA_HOME/scripts… then I added below code to the outgoing sync…

ExalateEventListener.hangListener(connection,{
String localIssueKey,
String remoteIssueKey,
localIssue,
remoteIssue ->

localIssue.customFields.“Published External URL”.value = remoteIssueKey
})

I am seeing this Error…

~Samip

Francis Martens (Exalate) commented on 03 September 2019

This is to be expected when Exalate cannot access the external script - either because of a path or a permission problem.

Can you check either?

Samip K Banker commented on 03 September 2019

user-50445 :

I double checked the path and its correct… permission wise the script has read permission… what permission do I need to set ?

~Samip

Francis Martens (Exalate) commented on 04 September 2019

Samip K Banker

Let’s review during the workshop. I guess it is a small thingy.

Francis Martens (Exalate) commented on 05 September 2019

We found it today. In case of a data center version of the underlying tracker - it needs to be copied to a folder under the shared-home

Samip K Banker commented on 09 September 2019

user-50445 :

This is working but not quite exactly…

ABC-23 is synced to EXT-234
ABC-23 will have the “Published URL” as EXT-234

EXT-234 is synced to EXTP-567
EXT-234 now will have the “Published URL” as EXTP-567

But what we want is this…
ABC-23’s “Published URL” to have EXTP-567

~Samip

Samip K Banker commented on 10 September 2019

user-50445 :

Do you have any recomendation on how we achive this?

~Samip

Francis Martens (Exalate) commented on 10 September 2019

Do you have the ‘Published URL’ in the outgoing sync of the connection between ABC and EXT?

When exalate adapts the value of that custom field, a sync will be triggered between EXT and ABC. You can then configure the incoming sync of the ABC-EXT connection to update a custom field on the ABC issue.

Would that help?

Samip K Banker commented on 10 September 2019

user-50445 :

Yes, for the Outgoing Sync Connection between ABC and EXT we have this…

ExalateEventListener.hangListener(connection,{ 
        String localIssueKey, 
        String remoteIssueKey, 
        localIssue, 
        remoteIssue ->
        localIssue.customFields."Published External URL".value =  remoteIssueKey
})

We don’t have anything in the incomming Sync of ABC-EXT… what do I need to put in ABC-EXT Incomming Sync?

Francis Martens (Exalate) commented on 10 September 2019

in the incoming sync - something like

issue.customFields."Published External URL".value = replica.customFields."Published External URL".value

Make sure that the customField is in the replica by adding in the outgoing sync

replica.customFields."Published External URL" issue.customFields."Published External URL"
Jorge Jerez Ibáñez commented on 22 February 2021

Is this still working? I’m not abble to see the file ExalateEventListener.groovy but I’ve the same problem