Abstract
This code snippet sets a Versions field to an unreleased version whose release date is nearest to a specific date.
Logic
Fetch the unreleased versions of the Project the issue belongs to and iterate over them to find the version with a Release date nearest to a specific date.
Snippet
def version issue.getAvailableOptions("versions").each{ if(!(it.isReleased()) && issue.get("<Date field name>") >= it.getReleaseDate()) { version = it } } version?.getName()
Placeholders
Placeholder | Description | Example |
---|---|---|
<Date field name> | Name of the field of type Date | duedate |
Examples
The output of this snippet is a String representing the name of a Version which you can use in a Groovy expression, for example, to set a Version picker field in:
- one of the Set Field Value post-functions
the Create issue post-function under Set fields of new issue section
References
Related articles
Filter by label
There are no items with the selected labels at this time.