Welcome to the Atlassian Community!
What scripting function are you using?
Hello,
We are using Groovy scripting.
import com.atlassian.jira.component.ComponentAccessor
def projectManager = ComponentAccessor.getProjectManager()
def versionManager = ComponentAccessor.getVersionManager()
def project = projectManager.getProjectObjByKey("INT") //Change project key here for the project you want to change
//100p to create version list
for(int i = 170; 1<=220; i++) { //loop from which to which version you want to update variably
String secondstr = "3.1.28.0" +i; //add the fixed value here which won't change
versionManager.createVersion(secondstr,null,null, "",project.id,null)
}
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is a script which adds versions. What is the question about deleting them?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are looking for script to bulk delete a series of project version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have used below script for deleting the Versions, but it is showing Error
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.component.ComponentAccessor
def projectManager = ComponentAccessor.getProjectManager()
def versionManager = ComponentAccessor.getVersionManager()
def project = projectManager.getProjectObjByKey("RPT") //Change project key here for the project you want to change
def versions = versionManager.getVersions(project)
log.warn(versions)
def noOfVersions=versions.size()
log.warn(noOfVersions)
for(def i="3.1.28.068765";i<="3.1.28.068769";i++) {
//String secondstr = "3.1.28.068" +i; //add the fixed value here which won't change
Version versionToDelete=versions[i]
versionManager.deleteVersion(versionToDelete)
}
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What are the errors you are getting?
I'd guess at the line with the loop on it being a problem - your def statement in there is defining i as a string, which you can't iterate over.
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.