Questions for Confluence license has expired.

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

Number value expected as the Sprint id

 
1
0
-1

Hi, I have some questions about synchronizing linked sprints.

For the context, here is my code.

// The sprint from the incoming message.  
def remoteSprint = replica.customFields.Sprint?.value?.find { it.state.toUpperCase() != "CLOSED" };

// Current local sprint. 
def currentLocalSprint = issue.customFields.Sprint?.value?.find { it.state.toUpperCase() != "CLOSED" };

// The new local sprint, according to the incoming message, translated to local IDs.  
def newLocalSprint = remoteSprint?.id == null ? null : nodeHelper.getLocalIssueKeyFromRemoteId(remoteSprint?.id, "sprint");

if (currentLocalSprint?.id?.toString() == newLocalSprint?.id?.toString()) {
    // DO NOTHING
    // It is already well configugured. 
    // Both null or with the same ID.  
} else if (remoteSprint?.id != null && newLocalSprint?.id == null) {
    // DO NOTHING
    // The sprint was not synchronized, because the project existed before the synchronisation. 
    // So, we simply ignore this cas. 
} else if (currentLocalSprint?.id != null && remoteSprint?.id == null) {
    // The issue was moved to Backlog. 
    issue.customFields.Sprint.value = nodeHelper.getCustomFieldDefaultValue("Sprint", issue)
} else if (newLocalSprint?.id != null) {
    // Finaly, I can set a sprint. 
    issue.customFields.Sprint.value = newLocalSprint.id
} else {
    // I'm not supposed to be here. 
    debug.error("Lost in the dark" + [remoteSprint?.id, remoteSprint?.id?.class, currentLocalSprint?.id, currentLocalSprint?.id?.class, newLocalSprint?.id, newLocalSprint?.id?.class].join(";"));
}



Why, by going through the first "if" close, I have an error "Number value expected as the Sprint id" ?

Values are already right, I do nothing.


How could I get the status for newLocalSprint ?

With the method nodeHelper.getLocalIssueKeyFromRemoteId(remoteSprint.id, "sprint"), only the id is filled. How to get more information ?

Did not find any clue in the documentation.


Thanks in advance for your help.

Matthias

    CommentAdd your comment...