2
1
0

Hello,


the sprint sync script from the documentation does not account for the local sprint being closed:


def remoteSprintId = replica.customFields.Sprint?.value?.find { it -> it.state.toUpperCase() != "CLOSED" }?.id
    if(remoteSprintId){
       def localSprintId = nodeHelper.getLocalIssueKeyFromRemoteId(remoteSprintId, "sprint")?.id
         if(localSprintId){
            issue.customFields.Sprint.value = localSprintId
        }
    }


If localSprint is closed then exalate will throw the following error:

services.jcloud.exception.UpdateIssueJiraCloudException: Could not update issue 


because Closed sprints cannot be assigned to issues. How to solve this here?

    CommentAdd your comment...

    3 answers

    1.  
      1
      0
      -1

      I resolved my issue. I found that the below script gives me the sprint Id


      def remoteSprintId = replica.customFields.Sprint?.value?.find { it -> it.state.toUpperCase() != "CLOSED" }?.id
      if(remoteSprintId){
          issue.customFields."Sprint".value = remoteSprintId.toLong()
      }

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi, I have issue with sync sprints as well


        https://docs.exalate.com/docs/how-to-sync-sprints


        this part


        def remoteSprintId = replica.customFields.Sprint?.value?.find { it -> it.state.toUpperCase() != "CLOSED" }?.id


        always come up as null


        Has anyone here ever had a working sync sprint script for Cloud?


        Thanks

          CommentAdd your comment...
        1.  
          1
          0
          -1

          Did you ever find a solution for this issue?

          1. Jonathon Sisson

            Using this snippet I have been able to at least check if the sprint is currently closed which helped a lot with dealing with this issue:

            def remoteSprintId = replica.customFields.Sprint?.value?.find { it.state.toUpperCase() != "CLOSED" }?.id
            if(remoteSprintId){
              
                    def localSprintId = nodeHelper.getLocalIssueKeyFromRemoteId(remoteSprintId, "sprint")?.id
                    if(localSprintId){
                        def currentState = httpClient.get("/rest/agile/1.0/sprint/"+localSprintId)?.state?.toLowerCase()
            if(currentState && currentState != "closed"){
                            issue.customFields.Sprint.value = localSprintId
                        }
                    }       
                }
          CommentAdd your comment...