JIRA SERVER JIRA CLOUD

This article shows how to synchronize sub-task on Jira Server using External scripts library.

When syncing sub-task it's important to keep the parent-child relation.  Exalate external script SubTaskSync.groovy allows to sync sub-tasks even if the parent task is not synced yet.


Configuration

Let's consider you already have the Connection configured between two JIRA Instances.

Now you need to configure sub-task synchronization: 

Jira Server

  1. Create files from the Exalate public repository

    We store external scripts for Jira Server in a public repository.  Copy the code from the repositories below and create .groovy files. You must keep the file names as below.

  2. Upload the files to the $JIRA_HOME/scripts directory

  3. Configure Sync Rules with the scripts provided below:

    Add the snippets below to the end  of the Sync Rules.

Source side

Outgoing sync(data filter)

SubTaskSync.send (replica, issue)

Destination side 

Incoming sync for new issues(create processor)

SubTaskSync.receiveBeforeCreation(replica, issue, nodeHelper)
return CreateIssue.create(
		replica,
    	issue,
    	connection,
    	nodeHelper,
    	issueBeforeScript,
    	remoteReplica,
    	traces,
    	blobMetadataList) {
    SubTaskSync.receiveAfterCreation(replica, issue, nodeHelper)
}

Jira Cloud

You don't need to upload the SubTaskSync.groovy and other .groovy files, since all available external scripts for Jira Cloud app are already there.


Configure Sync Rules with the scripts provided below:

Add the snippets below to the new line in the end of the existing scripts.

Source side

Outgoing sync(data filter)

SubTaskSync.send(replica, issue, relation, httpClient)


Destination side 

Incoming sync for new issues(create processor)

SubTaskSync.receiveBeforeCreation(replica, issue, nodeHelper)

return CreateIssue.create(
                replica,
                issue,
                connection,
                issueBeforeScript,
                traces,
                blobMetadataList,
                httpClient,
                syncRequest) {

            SubTaskSync.receiveAfterCreation(replica, issue, connection, nodeHelper)
}

Sub-task creation is performed only by the create processor once.