Custom field removable for 691 Jira's

Roja Gurram March 14, 2021

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!!

1 answer

0 votes
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 14, 2021

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

Roja Gurram March 14, 2021

Hi Gonchik,

 

How to remove the  VALUE for Sprint Custom field for 691 Jira tickets ?

 

Could you pls answer to that pls!

Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 14, 2021

@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. 

https://confluence.atlassian.com/jiracoreserver/editing-multiple-issues-at-the-same-time-939937916.html

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.3.1
TAGS
AUG Leaders

Atlassian Community Events