Fetch the end date of the active Sprint the issue belongs to
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
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.
for (Object sprint : issue.get("Sprint")) { if (sprint.isActive()) return sprint.getEndDate().toDate() - 2; }