How to Sync Sprints in Jira Cloud

    This article shows how to synchronize sprints in Exalate for Jira Cloud.

    Note: You need to sync sprints with a trigger before syncing issues.

    Introduction

    Exalate for Jira Cloud allows you to do sprint synchronizations.

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

    Note: Sprint synchronization in Jira Cloud is available only for Connections in the Script Configuration Mode.

    The scripts below use board IDs to identify what sprints to sync. For example, if you enter a Board ID 1, you will sync all sprints from that board.

    Source Side

    Outgoing Sync

    To send the sprint data use the following script:

    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

    Incoming sync

    To sync 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?.find { it.state.toUpperCase() != "CLOSED" }?.id
        if(remoteSprintId){
           def localSprintId = nodeHelper.getLocalIssueKeyFromRemoteId(remoteSprintId, "sprint")?.id
             if(localSprintId){
    			issue.customFields.Sprint.value = localSprintId
            }
        }
    }

    How to start Sprint Synchronization

    To start the synchronization of a sprint you need to Create a Trigger and select the sprint entity type.

    Filter sprints to sync with the If clause. For example, if you enter Board IDs 1, 2, and 3, you will sync all sprints from these boards. To synchronize all sprints leave the If block empty.


    You can check the sprint sync status with the help of the Entity Sync Status panel in the Exalate admin menu.

    Have more questions? Ask the community