I am trying to update the releases on a jira project using Scriptrunner Schedule jobs option :-
The code i used is as below
you can use the editVersionStartReleaseDate
method from the VersionManager
class to update the start and release dates of a version. Here's an updated version of your script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.project.version.VersionManager
// Specify the project key and release ID
def projectKey = "TJ" // Replace with the key of your Jira project
def releaseId = 1234 // Replace with the actual release ID
def versionName = "APP V1.2.3"
// Specify the new start and release dates
def newStartDate = new Date() // Replace with the desired start date
def newReleaseDate = new Date() + 7 // Replace with the desired release date
// Get the version manager
def versionManager = ComponentAccessor.getComponent(VersionManager)
// Get the project by project key
def project = ComponentAccessor.getProjectManager().getProjectByCurrentKey(projectKey)
// 2 ways to find the version:
// 1. Find the version using release or version id
def version = versionManager.getVersion( releaseId )
// or
// 2. Find the version by project ID and version name
// def version = versionManager.getVersionByName(project.id, versionName)
// Update the start and release dates if the version exists
if (version) {
// Update the start and release dates
versionManager.editVersionStartReleaseDate(version, newStartDate, newReleaseDate)
} else {
// Version not found
log.error("Version not found for project $projectKey and name $versionName.")
}
I tried the changed code as you suggested, however it gives error in the last line of editVersionStartReleaseDate as below
[Static type checking] - Cannot find matching method com.atlassian.jira.project.version.VersionManager#editVersionStartReleaseDate(java.lang.String, java.util.Date, java.util.Date). Please check if the declared type is correct and if the method exists.
I also tried the option of create version which also fails with error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the changed code but it is still giving me error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Code is updated once again. There are two ways to retrieve the version/release object
1. Find the version using release or version id
def version = versionManager.getVersion( releaseId )
2. Find the version by using project ID and version name
def version = versionManager.getVersionByName(project.id, versionName)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for delayed response, we have could fix the issue.
Thanks for your help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.