Does the exalate support to unexalate the connected issue auto for specified connection when I close the issue?

Originally asked by Helen Li on 25 January 2021 (original question)


Dear Sir

Does the exalate support to unexalate the connected issue auto for specified connection when I close the issue? If yes, how to do it?

We are using the Jira server version.

Best regards,

Helen Li


Answer by Ariel Aguilar on 24 February 2021

Hi Helen,

Sure, this could be accomplished with the following snippet.

Incoming Sync:

if (replica.status.name == "Closed") {
  // stop sync if remote issue has been closed.
  final def _syncInitService = com.atlassian.jira.component.ComponentAccessor
    .getOSGiComponentInstanceOfType(com.exalate.api.trigger.ISyncInitiationService.class)
  _syncInitService.unexalate(issueKey.id as Long)
  return
}

The snippet above would unexalate the issue as soon as the remote issue is changed to the closed status. Alternatively, if you want to unexalate the issue when the status is changed to closed locally, you can use the following snippet:

if (issue.status.name == "Closed") {
  // stop sync if remote issue has been closed.
  final def _syncInitService = com.atlassian.jira.component.ComponentAccessor
    .getOSGiComponentInstanceOfType(com.exalate.api.trigger.ISyncInitiationService.class)
  _syncInitService.unexalate(issueKey.id as Long)
  return
}

Let me know if this is sufficient for you!

Thanks,

Ariel


Comments:

Benjamin Kiene commented on 06 August 2021

Hi,

Would the same be possible on Jira Cloud?

Thank you,

Ben

Salma Nairi commented on 23 September 2021

Hi Ariel Aguilar

i m trying to use your code but i had this error although the cast is done

Script error for issue “ISSUEKEY”. Details: No signature of method: com.exalate.trigger.SyncInitiationService.unexalate() is applicable for argument types: (java.lang.Long) values: [153828] Possible solutions: unexalate(java.lang.String).

could please advice me

thanks

Salma Nairi commented on 23 September 2021

// stop sync if remote issue has been closed.
final def _syncInitService = com.atlassian.jira.component.ComponentAccessor
.getOSGiComponentInstanceOfType(com.exalate.api.trigger.ISyncInitiationService.class)
_syncInitService.unexalate(issueKey.id as String)
this code is working with String cast

i note that if remote issue is exalated with another issue by another connection , this connection
is unexalate too ?
how can we indicate only a current connection ( connection used from issue not replica

)tthanks

Salma Nairi commented on 23 September 2021

hi

sorry , i re tested this code but it didn’t work

where should i put it in incoming rule, on top ?