Is is possible to also exalate linked issues when a issue is exalated?

Originally asked by Sai Thakur on 13 July 2020 (original question)


I would like to know if it is possible to automatically exalate linked issues when an issue is exalate. we have a use case where we would like to exalate “Milestone” Issuetype linked to an “Epic” when Epics on different instances are exlated.


Answer by André Leroy-Beaulieu Castro on 13 July 2020

Hi Sai,

I built this little snippet for you, you can add this to the end of your Outgoing script on the side that is creating the Epics with the issue links, can you try this out and let me know:

if (issue.typeName == "Epic") {
    def exaCl = com.atlassian.jira.component.ComponentAccessor
        .pluginAccessor
        .getEnabledPlugin("com.exalate.jiranode")
        .getClassLoader()
    def exaSyncServiceClass = exaCl.loadClass(
    "com.exalate.api.trigger.ISyncInitiationService"
    ) 
    def syncService = com.atlassian.jira.component.ComponentAccessor.getOSGiComponentInstanceOfType(
        exaSyncServiceClass
    )
     def im = com.atlassian.jira.component.getIssueManager()
    replica.issueLinks.collect{ link ->
     def linkedIssue = im.getIssueObject(link.otherIssueId)
     if (linkedIssue.issueType.name == "Milestone") {
        syncService.pair(
          linkedIssue.key, // specify the issue key you want
          connection.name // set the relevant connection name
        )
     }
  }
}

Thanks,

André