I have a project with hundreds of issues, each of which may have a different "fixVersion" associated with it. I want to do a "Bulk Edit" on all of these issues at once where I simply ADD a new fixVersion to each issue, as opposed to replacing the fixVersions that are already there. Is this possible?
I seem to have done this before at one point, but I don't remember how I was able to do that. Are there certain restrictions or constraints in place which turn this ability on or off when doing bulk changes?
As a simple example, let's say I have 3 issues with the fixVersion = "current". I decide that I would also like to add the fixVersion = "new" to these issues. I query them in the Issue tab and select "Bulk Change". I select all of them from the list, choose to bulk edit them, and select the 'Change fixVersions' option with the value "new".
My hope is that the outcome are 3 issues with the old AND the new fixversion (ie, "current" & "new" are both a fixVersion in the 3 issues).
Hope that makes sense! Let me know if this is possible or if there are any workarounds to do something like this.
You can use Script Runner plugin and the following script to add Versions to a JQL search.
import com.atlassian.crowd.embedded.api.User import com.atlassian.jira.bc.issue.IssueService import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.index.IssueIndexManager import com.atlassian.jira.project.ProjectManager import com.atlassian.jira.project.version.VersionManager import com.atlassian.jira.util.ImportUtils import com.atlassian.jira.web.bean.PagerFilter String jql = 'project = XXX' String projectKey = 'XXX' String newVersion = '1.35' IssueService issueService = ComponentAccessor.getIssueService() IssueManager issueManager = ComponentAccessor.getIssueManager() VersionManager versionManager = ComponentAccessor.getVersionManager() ProjectManager projectManager = ComponentAccessor.getProjectManager() IssueIndexManager indexManager = ComponentAccessor.getIssueIndexManager() SearchService searchService = ComponentAccessor.getComponent(SearchService.class); User user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser() List<Issue> issues = null SearchService.ParseResult parseResult = searchService.parseQuery(user, jql); if (parseResult.isValid()) { def searchResult = searchService.search(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter()) issues = searchResult.issues.collect {issueManager.getIssueObject(it.id)} } else { log?.error("Invalid JQL: " + jql); } projectId = projectManager.getProjectObjByKey(projectKey)?.id newVersionId = versionManager.getVersion(projectId, newVersion)?.id if (newVersionId) { issues?.each{ iiparams = issueService.newIssueInputParameters() iiparams.setRetainExistingValuesWhenParameterNotProvided(true, true) iiparams.setApplyDefaultValuesWhenParameterNotProvided(false) iiparams.setSkipScreenCheck(true) List versionIds = it.getFixVersions()*.id versionIds << newVersionId iiparams.setFixVersionIds((Long[]) versionIds.toArray()) vresult = issueService.validateUpdate(user,it.id, iiparams) if (vresult.isValid()) { uresult = issueService.update(user, vresult, EventDispatchOption.DO_NOT_DISPATCH, false) if (uresult.isValid()) { boolean wasIndexing = ImportUtils.isIndexIssues(); ImportUtils.setIndexIssues(true); indexManager.reIndex(uresult.getIssue()); ImportUtils.setIndexIssues(wasIndexing); } else { log.error uresult.getErrorCollection().getErrors() } } else { log.error vresult.getErrorCollection().getErrors() } }?.size() }
You have to adapt the three rows containing the JQL, the project and the version to your needs. The script only works for issues of one project because versions are project specific.
Please test the script on a test environment first, because I put it together by dragging and dropping parts from other scripts :-)
Henning
I'm almost sure you can do that with the Script Runner plugin. It's free and you can get it in the Atlassian Market. There's a lot of documentation for the plugin too. Check it out.
Hope this helps.
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.