Bulk Delete/Remove Custom Field Values

Ron Gates June 13, 2017

Hi,

ScriptRunner has ability to import custom field values in bulk (https://scriptrunner.adaptavist.com/4.3.6/jira/builtin-scripts.html#_bulk_import_custom_field_values) but I need to remove/delete all of the custom field values - any way to do this with ScriptRunner (maybe running script from Script Console)?

Thanks for help in advance!

2 answers

2 votes
Ron Gates June 14, 2017

Any way of doing this that doesn't involve deleting field values one by one?

Scheibli Márk July 18, 2017

Have you found any solution for removing field values one by one?

0 votes
Gaston Valente
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 Leaders.
July 18, 2017

Hi,

I'm sorry if i don't understand the question but what about a groovy scriptrunner script to do a jql query to obtain all issues with values at the particular field and then do and then set the value to null on this fields?

i think i have an snippet to do that

 

Scheibli Márk July 18, 2017

Is it not possible to do in simple Java and not in groovy?

Gaston Valente
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 Leaders.
July 18, 2017

Yes, of couse, but you need to create a custom service i think.

You need to download the sdk, create an skeleton of jira plugin, add your login and then install the plugin in your instance.

It's more work, the code should look very similar.

 

Scheibli Márk July 18, 2017

okay, i will try jql query to search the issues and the label with the values. Thanks for the help.

Gaston Valente
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 Leaders.
July 18, 2017

Here you can find great examples:

https://jamieechlin.atlassian.net/wiki/spaces/GRV/pages/1212431/Miscellaneous+Groovy+Scripts

"Executing a Query"

package examples.docs
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser.class)
def searchProvider = ComponentAccessor.getComponent(SearchProvider.class)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getUser()

// edit this query to suit
def query = jqlQueryParser.parseQuery("project = JRA and assignee = currentUser()")
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())

results.getIssues().each {documentIssue ->
log.debug(documentIssue.key)

// if you need a mutable issue you can do:
def issue = issueManager.getIssueObject(documentIssue.id)
// do something to the issue...
log.debug(issue)
}

 

Suggest an answer

Log in or Sign up to answer