Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Abstract

This code snippet fetches the end date of the currently active sprint the issue belongs to.

Logic

  • Iterate over each Sprint the issue is associated to.
  • Against each Sprint check the status of the Sprint.
  • Fetch the end date of the Sprint that is active

Snippet

Code Block
languagegroovy
linenumberstrue
for (Object sprint : issue.get("Sprint")) {
  if (sprint.isActive())
    return sprint.getEndDate().toDate();
}

Examples

The output of the code snippet is a date+time which you could use in a Groovy script, for example, to calculate and display the Due date of the issue as the Sprint end date minus 2 days.

Code Block
languagegroovy
linenumberstrue
for (Object sprint : issue.get("Sprint")) {
  if (sprint.isActive())
    return sprint.getEndDate().toDate() - 2;
}

References