I have a filter which includes 99 issues. They all have fix versions set (one or more) and now we want to add a common fix version to theses issues. Add - which means that we want to keep the existing fix versions. If I use the bulk edit functionality the old versions will be replaced by the new.
(How )can this be done without doing it manually for each issue?
you could use the csv-importer to achive this. The file needs to look like this.
id, Summary, FixVersion, FixVersion, FixVersionxx-1,"First issue", v1, , xx-2, "Second issue", v2, , xx-3, "Third issue", v1, v2, v3for details please see hereUdo, do you mean I need to first export and then import? Will that not replace? Can I do this and only get an update of the issue you mean?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Susanne,
yes, export Issuekey, summary and fixVersion and then edit the csv (add your new version) and reimport the csv. It will do updates to the fields (only on fixVersion ) issuekey and summary are not affected but required
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Cool, thanks. I will try this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad I could help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Udo! This work well in test and now I will do this in production.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the following Script Runner script to add versions to a JQL search.
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.bc.JiraServiceContextImpl
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.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 = TIQA and priority = Critical'
String projectKey = 'TIQA'
String newVersion = '1.35'
IssueService issueService = ComponentAccessor.getIssueService()
VersionManager versionManager = ComponentAccessor.getVersionManager()
ProjectManager projectManager = ComponentAccessor.getProjectManager()
IssueIndexManager indexManager = ComponentAccessor.getIssueIndexManager()
User user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
log?.debug "..Got user $user"
issues = getFilterResult(jql,user,log)
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()
}
List<Issue> getFilterResult(String jqlSearch, User user, log = null) {
SearchService searchService = ComponentAccessor.getComponent(SearchService.class);
def ctx = new JiraServiceContextImpl(user)
log?.debug "..Got ServiceContext $ctx"
List<Issue> issues = null
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlSearch);
if (parseResult.isValid()) {
def searchResult = searchService.search(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
issues = searchResult.getIssues()
log?.debug "Found ${issues.size()} issues...\n"
} else {
log?.error("Invalid JQL: " + jqlSearch);
}
return issues
}
You have to change jql, projectKey and newVersion to match your situation. Please try on a test system first. :-)
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! I will look into this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Guys could you please let me know if there is a way to convert CSV file in FIX format?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
JIRA Command Line Interface using something like:
--action runFromIssueList --search " <some JQL> " --common "--action updateIssue --issue @issue@ --fixVersions v1 --append"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bob! This might also be useful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I haven't tested this specifically, but let's say you now have sprint 1, 2, 3 and 4 as versions. If you create version 1.0, and make those sprint versions "children" under version 1, I believe all of them will keep the initial sprint (e.g. 1, 2, 3 or 4) and at the same time be tagged with version 1 in the fix verison field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your quick respons. Children? I am not talking about sprints, only versions and as far as I have seen there is no "tree" functionality for versions or have I missed something.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using Greenhopper? In Greenhopper a version can have a "parent" version, see here for some info: https://confluence.atlassian.com/display/GH/Setting+Up+a+Version+Hierarchy.
If you have parent-child hiercarchy, the fix version will automatically include both versions (e.g. both parent and child version).
Sprint was just a example. You could have v.0.1, v.0.2, v.0.3, v.04 and then make version 1.0 the parent of them all.
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.