Hi All,
I need help with cleaning up JIRA, please: CLIENT has accidentally assigned a sprint to 691 JIRA tickets. Can we pls reverse that?
How to remove the VALUE for Sprint Custom field for 691 Jira tickets ?
Kindly someone advise pls!!
Hi!
If you know exact scope, you can set null value via groovy on that tickets.
String jqlSearch = ' JQL_QUERY_WITh_SCOPE'
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
IssueManager issueManager = ComponentAccessor.getIssueManager()
SearchService searchService = ComponentAccessor.getComponent(SearchService.class)
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlSearch)
CustomFieldManager customerFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField myCustomField = customerFieldManager.getCustomFieldObjectByName("Sprint")
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService.class)
if (parseResult.isValid()) {
def searchResult = searchService.search(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
def issues = searchResult.issues.collect { issueManager.getIssueObject(it.id) }
for (issue in issues) {
myCustomField.updateValue(null, issue, new ModifiedValue(null, null), new DefaultIssueChangeHolder())
log.debug "Done for ${issue.key}"
boolean wasIndexing = ImportUtils.isIndexIssues()
ImportUtils.setIndexIssues(true);
log.warn("Reindex issue ${issue.key} ${issue.id}")
issueIndexingService.reIndex(issue)
ImportUtils.setIndexIssues(wasIndexing)
}
}
in general cleanup you can try that number of scripts https://github.com/gonchik/cleanup-scripts
Hi Gonchik,
How to remove the VALUE for Sprint Custom field for 691 Jira tickets ?
Could you pls answer to that pls!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Roja Gurram Do you use the scriptrunner/mygroovy/Power Groovy for Jira/SIL groovy connector you can try to use the code I provided in previous comment.
I just rewrote for your instance based on info of 7.3.1 version the code
searchResult.issues.collect
Otherwise, if you familiar SQL you can use the 2 table customfield and customfield value with join jiraissue, again if you know exact number of scope.
1. You need to remove records
2. Restart Jira
3. Reindex Jira (or related projects)
Also, please, do on test env first, if you're not familiar with SQL, groovy.
The last unuseful possible at least to me, it's bulk change.
As result you will have change history and will update tickets, to me is not good way. But for many companies it's useful solution
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.