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 |
---|
language | groovy |
---|
linenumbers | true |
---|
|
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 |
---|
language | groovy |
---|
linenumbers | true |
---|
|
for (Object sprint : issue.get("Sprint")) {
if (sprint.isActive())
return sprint.getEndDate().toDate() - 2;
} |
References