Document toolboxDocument toolbox

(8.7.0) Last release date

Title

Last release date

Description

It returns the release date of the last version of the project based on its release date

Objective

Get to know when was a project's last release date

Audience
  • Release managers
  • Project managers
  • Product managers
  • Scrum Masters
  • Dev Teams
What does a Jira Project Represent?It represents Software that needs to pass though every development phase, including QA 
Focus

Project tracking and monitorization

Configuration

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

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

Pre-requisites: N/A

Description: It returns the release date of the last released version in the current project

Use in: It should be used as a Projectrak Script field

Variables in context: 

  • project [com.atlassian.jira.project.Project]: The current project

Groovy Script

last-release-date.groovy
import com.atlassian.jira.component.ComponentAccessor
import com.deiser.jira.profields.util.ProfieldsConstants
import java.text.SimpleDateFormat

// Components
def applicationProperties = ComponentAccessor.applicationProperties

// Script Variables
def datePattern = applicationProperties.getDefaultBackedString("jira.lf.date.dmy")
def formatter = new SimpleDateFormat(datePattern)

// 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 date of the version in system date format
if(latestVersion == null || latestVersion.releaseDate == null){ return "-" }
return formatter.format(latestVersion.releaseDate) 


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.

5. The result show be something like this: (please, keep in mind that this is only an example and your results should vary from what it is shown in the screenshot).