You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
How to delete versions from Script?
Thanks,
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.