Versions Compared

Key

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

Description

It returns the name of the last released version in the current project

Configuration

1. Create a Projectrak Script field called "Last release name".

2. Insert the following Groovy script and modify according to your instance into "Last release name" field

Groovy Script

...

last-release-name.groovy
linenumbers
Code Block
languagetruegroovy
package deiser.profields.scripts

import com.atlassian.jira.component.ComponentAccessor

// Get the released versions for the project. The archived versions are excluded.
def releasedVersions = ComponentAccessor.versionManager.getVersionsReleased(project.id, false)

// Get the latest version sorting by release date
def latestVersion = releasedVersions.sort { versionA, versionB -> (versionB.releaseDate <=> versionA.releaseDate) }.find {it!=null}

// Returns the name of the version
return latestVersion ? latestVersion.name : "-"

3. Configure the project's layout including all of the fields created.

4. Associate the Layout to the project you need this information to be applied to. 

...