The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom field removable for 691 Jira's

Roja Gurram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Gonchik Tsymzhitov
Community Champion
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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
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 Champion
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

DEPLOYMENT TYPE
SERVER
VERSION
7.3.1
TAGS
AUG Leaders

Atlassian Community Events