Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically set next unreleased fixVersion for new issue created during a transition?

Danilo Ferrari August 12, 2019

Hi Guys,

 

I am new to the development environment and learning to deal with groovy.

I am trying to create a post-function script that defines the version of the project that is being created in this script.

Another point is that I need the start and release dates of the version being created to be the same as the user will place on the create screen in a custom date collector type field.

Please help me, I crashed and I can't evolve anymore.

Thanks in advance.

Here's code so far:


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.project.version.VersionManager
import com.atlassian.jira.bc.issue.IssueService.IssueValidationResult
import com.atlassian.jira.event.project.VersionCreateEvent



def projectManager = ComponentAccessor.getProjectManager()
def project = projectManager.getProjectObjByKey("TCR") 


def versionManager = ComponentAccessor.getVersionManager()
versionManager.createVersion(project.key + " " + issue.getSummary(), new Date(), "Release Criada Automaticamente pelo issue" + " " + issue.key, project.id, null)


def versions = versionManager.getVersionsUnreleased(issue.getProjectObject().getId(), false)
issue.setFixVersions([versions.first()])

 

 

  1. new Date()   //should be the start date
    The release date should be set here as well. Both information is in the issue creation screen.
  2. def versions = // must define the version just created by this script

0 answers

Suggest an answer

Log in or Sign up to answer