How to sync issues automatically using Exalate API in Jira On-premise

    This article shows how to start issue synchronization automatically with the help of Exalate API.

    Sync an issue according to the specified issue key 

    1 def exaCl = com.atlassian.jira.component.ComponentAccessor
    2        .pluginAccessor
    3        .getEnabledPlugin("com.exalate.jiranode")
    4        .getClassLoader()
    5 def exaSyncServiceClass = exaCl.loadClass(
    6    "com.exalate.api.trigger.ISyncInitiationService"
    7 )  
    8 def syncService = com.atlassian.jira.component.ComponentAccessor.getOSGiComponentInstanceOfType(
    9        exaSyncServiceClass
    10 )
    11 syncService.pair(
    12    "PROJ-23", // specify the issue key you want
    13    "ConnectionTest" // set the relevant connection name
    14 )