Confluence has been updated to version 6.15.9

This article shows how to synchronize sprints on Jira. 

Introduction

We've introduced sprint synchronization on Jira Server v.4.7.0 and Jira Cloud v5.1.0.

You can add sync rules to synchronize sprint information. Exalate considers issues and sprints as independent entities. 

Sprint synchronization on Jira Cloud is available only for connections created in scripting mode. 


Configuration

Source side

Outgoing sync

To send the sprint data use the code below  

def boardIds = ["50", "80", "130", "144"] //Boards which sprints will get synced
if(entityType == "sprint" && boardIds.find{it == sprint.originBoardId}){
    replica.name = sprint.name
    replica.goal = sprint.goal
    replica.state = sprint.state
    replica.startDate = sprint.startDate
    replica.endDate = sprint.endDate
    replica.originBoardId = sprint.originBoardId
}
if(entityType == "issue"){
   //Executed when syncing an issue to a remote side
   replica.summary = issue.summary
   replica.description = issue.description
   replica.project = issue.project
   replica.type = issue.type
	//....
	//other script rules to sync issues
	//sprint....
   replica.customFields.Sprint = issue.customFields.Sprint
}

Destination side  

Jira Cloud

Incoming sync

To apply the received sprint data on your side add the code below

//entityType represent the type of the remote side entity
if(entityType == "sprint"){
    //Executed when receiving a sprint sync from the remote side
    def sprintMap = ["162":"50", "197": "80", "214": "130", "225": "144"] //[remoteBoardId: localBoardId]
    
    sprint.name = replica.name
    sprint.goal = replica.goal
    sprint.state = replica.state
    sprint.startDate = replica.startDate
    sprint.endDate = replica.endDate
    def localBoardId = sprintMap[replica.originBoardId]
    if(localBoardId == null){
       throw new com.exalate.api.exception.IssueTrackerException("No board mapping for remote board id "+replica.originBoardId)
    }
    sprint.originBoardId = localBoardId //Set the board ID where the sprint will be created
}
if(entityType == "issue"){
    //Executed when receiving an issue sync from the remote side
	if(firstSync){
		issue.projectKey = "TEST"
    	issue.typeName = "Task"
	}
    issue.summary = replica.summary
    issue.description = replica.description
	//....
	//other script rules to sync issues
	//....
    def remoteSprintId = replica.customFields.Sprint?.value?.id.find()
    if(remoteSprintId){
       issue.customFields.Sprint.value = nodeHelper.getLocalIssueKeyFromRemoteId(remoteSprintId, "sprint")?.id
    }
}


Jira Server

//entityType represent the type of the remote side entity
if(entityType == "sprint"){
    //Executed when receiving a sprint sync from the remote side
    def sprintMap = ["162":"50", "197": "80", "214": "130", "225": "144"] //[remoteBoardId: localBoardId]
    
    sprint.name = replica.name
    sprint.goal = replica.goal
    sprint.state = replica.state?.toUpperCase()
    sprint.startDate = replica.startDate
    sprint.endDate = replica.endDate
    def localBoardId = sprintMap[replica.originBoardId]
    if(localBoardId == null){
       throw new com.exalate.api.exception.IssueTrackerException("No board mapping for remote board id "+replica.originBoardId)
    }
    sprint.originBoardId = localBoardId //Set the board ID where the sprint will be created
}
if(entityType == "issue"){
    //Executed when receiving an issue sync from the remote side
    issue.summary = replica.summary
    if(replica.projectKey == "SCRUM"){
        issue.projectKey = "SCRUM2"
    }
    if(replica.projectKey == "SCRUM2"){
        issue.projectKey = "SCRUM"
    }
     
    issue.typeName = replica.typeName
     
    def sprintV = replica.customFields.Sprint.value?.id.collect{ remoteSprintId ->
        return nodeHelper.getLocalIssueKeyFromRemoteId(remoteSprintId, "sprint")?.id?.toString()
    }.findAll{it != null}
     
    issue.customFields."Sprint".value = sprintV
     
}


You can control which sprints get synchronized from the outgoing sync rules.

When you don't want an entity to be synchronized, use return before actually setting any value on the replica.

if(entityType == "sprint" && sprint.originBoardId == "12"){
	//Only sync sprints on board 12
    if(sprint.id == "87") return //avoid syncing sprint with id 87
    replica.name = sprint.name
	replica.goal = sprint.goal
	replica.state = sprint.state
	replica.startDate = sprint.startDate
	replica.endDate = sprint.endDate
    replica.originBoardId = sprint.originBoardId
}
//The rest of your outgoing script

Fields of the sprint entity
field nametype
sprint.nameString
sprint.stateString
sprint.originBoardIdString
sprint.startDateDate
sprint.endDate Date
sprint.completeDateDate
sprint.goalString


How to start sprint synchronization?

To start the synchronization of a sprint you need to create a trigger and select entity type sprint.

Trigger sprint sync on Jira Cloud

To filter sprints use sprint board IDs, separated by a comma.

To synchronize all sprints leave the IF block empty. 


You need to sync sprint with the help of the trigger first and then start syncing issues.


Have more questions? Ask the community


How to create a trigger?


Back to Agile Board Synchronization