Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

Cannot Exalate Sprint

 
1
0
-1

Hi, I have the Exalate code set up to sync sprint.
However, the sprint is not entered properly in the Exalated ticket.
What's wrong with my code?


The sprint information is synchronized between the boards. However, it will not be automatically entered in the Exalated ticket.


My environment is JiraServer. Therefore, I referred to the following code.
https://docs.idalko.com/exalate/display/ED/How+to+sync+sprints+in+Jira+Server


I attach the incoming_example and outgoing_example codes. please refer.
And, I'm not sure which is "remote" and which is "local"...


Thank you very much in advance for all help.


incoming_example
// Sync Sprint
if(entityType == "sprint"){
    //Executed when receiving a sprint sync from the remote side
    def sprintMap = ["405":"114"] //[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
}

// Sync about ticket issue
if(entityType == "issue"){
    if(firstSync && replica.project.key == "TEST"){
        issue.projectKey = "MyBoard"
        issue.summary = "TEST::" + replica.summary
    }

    if(firstSync && replica.project.key == "MyBoard"){
        issue.projectKey = "TEST"
        issue.summary = "MyBoard::" + replica.summary
    }

    issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task"

    issue.reporter = nodeHelper.getUserByEmail(replica.reporter?.email)
    issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email)

    issue.description = replica.description
    issue.labels = replica.labels
    issue.comments = commentHelper.mergeComments(issue, replica)
    issue.attachments = attachmentHelper.mergeAttachments(issue, replica)

    //custom field id for Story Points field
    issue.customFields."10106".value = replica.customFields."10106".value

    //TEST-MyBoard
    // ["remote status name": "local status name"], 
    def statusMap = [
        "In Review": "In Progress",
        "Hold": "In Progress",
        "Waiting": "In Progress",
        "Assigned": "In Progress",
        "Canceled": "Done"
        ] 

    def remoteStatusName = replica.status.name
    issue.setStatus(statusMap[remoteStatusName] ?: remoteStatusName)

    // Sync sprint information
    def sprintV = replica.customFields.Sprint.value?.id.collect{ remoteSprintId ->
        return nodeHelper.getLocalIssueKeyFromRemoteId(remoteSprintId, "sprint")?.id?.toString()
    }.findAll{it != null}

    issue.customFields."Sprint".value = sprintV
}
outgoing_example
def boardIds = ["114"] //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
}

// Sync about ticket issue
if(entityType == "issue"){
    replica.key            = issue.key
    replica.type           = issue.type 
    replica.assignee       = issue.assignee 
    replica.reporter       = issue.reporter
    replica.summary        = issue.summary
    replica.description    = issue.description
    replica.labels         = issue.labels
    replica.comments       = issue.comments
    replica.resolution     = issue.resolution
    replica.status         = issue.status
    replica.parentId       = issue.parentId
    replica.priority       = issue.priority
    replica.attachments    = issue.attachments
    replica.project        = issue.project
    // sync sprint info
    replica.customFields.Sprint = issue.customFields.Sprint

    // 10106 is the custom field id for story points
    replica.customFields."10106"     = issue.customFields."10106"
}
  1. Ryoma Hagio

    Could you please point out the solution or mistake?
    I don't know why it doesn't work ...

CommentAdd your comment...