Versions Compared

Key

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

Abstract

This code snippet sets a Versions field to an unreleased version whose release date is nearest to a specific date. of an issue to the earliest unreleased version scheduled after a certain date

Logic

Fetch the unreleased versions of the Project the issue belongs to and iterate over them to find the earliest version with a Release date nearest to a specific date. scheduled after a certain date

Snippet

Code Block
languagejs
linenumberstrue
def version
issue.getAvailableOptions("versions").each{
  if(!(it.isReleased()) && issue.get("<Date field name>") >= it.getReleaseDate())
  {
    version = it
  }
}
version?.getName()

Placeholders

PlaceholderDescriptionExample
<Date field name>
Name of the field of type Dateduedate

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 inthe Fix Version/s of an issue to the earliest unreleased version scheduled after the Due date in:

  • one of the Set Field Value post-functions
  • the Create issue post-function under Set fields of new issue section

References

Filter by label (Content by label)
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "jmwe-groovy" and type = "page" and space = "KB"
labelsjmwe-nunjucks jmwe-cloud

...